updated on Thu Jan 19 16:10:29 UTC 2012
[aur-mirror.git] / inputlirc / inputlircd.init
blob3ad4f357066cc8da163f4d45ec99cbd0035569cc
1 #!/bin/bash
3 # source application-specific settings
4 INPUTLIRCD_ARGS=
5 [ -f /etc/conf.d/inputlircd ] && . /etc/conf.d/inputlircd
7 . /etc/rc.conf
8 . /etc/rc.d/functions
10 PID=`pidof -o %PPID /usr/sbin/inputlircd`
11 LIRCD_SYMLINKFILE=/dev/lircd
12 LIRCD_SOCKET=/var/run/lirc/lircd
13 case "$1" in
14 start)
15 stat_busy "Starting InputLIRCd Daemon"
16 [ ! -d /var/run/lirc ] && install -d /var/run/lirc &>/dev/null
17 rm -f $LIRCD_SOCKET && ln -s $LIRCD_SOCKET $LIRCD_SYMLINKFILE
18 if [ $? -ne 0 ]; then
19 stat_fail
20 exit 0
22 [ -z "$PID" ] && /usr/sbin/inputlircd ${INPUTLIRCD_ARGS}
23 if [ $? -gt 0 ]; then
24 stat_fail
25 else
26 add_daemon inputlircd
27 stat_done
30 stop)
31 stat_busy "Stopping InputLIRCd Daemon"
32 rm -f $LIRCD_SYMLINKFILE
33 [ ! -z "$PID" ] && kill $PID &> /dev/null
34 if [ $? -gt 0 ]; then
35 stat_fail
36 else
37 rm_daemon inputlircd
38 stat_done
41 restart)
42 $0 stop
43 sleep 1
44 $0 start
47 echo "usage: $0 {start|stop|restart}"
48 esac
49 exit 0