Repository navigation
Expand file tree
/
Copy pathlircd.init
More file actions
executable file
·113 lines (100 loc) · 2.27 KB
/
Copy pathlircd.init
File metadata and controls
executable file
·113 lines (100 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/sh
#
# lircd Linux Infrared Remote Control daemon
#
# chkconfig: 2345 65 35
# description: LIRC is a package that allows you to decode and send \
# infra-red signals of many (but not all) commonly used \
# remote controls.
#
# processname: lircd
# pidfile: /var/run/lirc/lircd.pid
# config: /etc/lirc/lircd.conf
# config: /etc/sysconfig/lircd
# Source function library
. /etc/rc.d/init.d/functions
# Get service config
[ -f /etc/sysconfig/lircd ] && . /etc/sysconfig/lircd
start() {
# Check if the service is already running?
if [ -f /var/lock/subsys/lircd ]; then
msg_already_running "Linux Infrared Remote Control daemon"
return
fi
msg_starting "Linux Infrared Remote Control daemon"
OPTIONS=""
[ -n "$DRIVER" ] && OPTIONS="--driver=$DRIVER"
[ -n "$DEVICE" ] && OPTIONS="$OPTIONS --device=$DEVICE"
#Check if use serial port
[ -n "$COM_PORT" ] && setserial $COM_PORT uart none
MODULE_OPTIONS=""
[ -n "$DRIVER_OPTS" ] && MODULE_OPTIONS="$DRIVER_OPTS"
modprobe -s lirc $MODULE_OPTIONS > /dev/null 2>&1
ln -sf /tmp/.lircd /dev/lircd
daemon lircd $OPTIONS
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/lircd
}
stop() {
# Stop daemons.
if [ ! -f /var/lock/subsys/lircd ]; then
msg_not_running "Linux Infrared Remote Control daemon"
return
fi
msg_stopping "Linux Infrared Remote Control daemon"
killproc lircd
rm -f /dev/lircd
rm -f /var/lock/subsys/lircd >/dev/null 2>&1
}
restart() {
test -f /var/lock/subsys/lircmd && RESTART_LIRCMD=yes
test -n "$RESTART_LIRCMD" && /sbin/service lircmd stop
stop
start
test -n "$RESTART_LIRCMD" && /sbin/service lircmd start
}
condrestart() {
if [ ! -f /var/lock/subsys/lircd ]; then
msg_not_running "Linux Infrared Remote Control daemon"
RETVAL=$1
return
fi
restart
}
reload() {
if [ ! -f /var/lock/subsys/lircd ]; then
msg_not_running "Linux Infrared Remote Control daemon"
RETVAL=7
return
fi
msg_reloading "Linux Infrared Remote Control daemon"
killproc lircd -HUP
RETVAL=$?
}
RETVAL=0
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
try-restart)
condrestart 0
;;
reload|force-reload)
reload
;;
status)
status lircd
exit $?
;;
*)
msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
exit 3
esac
exit $RETVAL