]> git.pld-linux.org Git - packages/lirc.git/blob - lircmd.init
138a66b6171da3bdcaacfc0d81448973d1822742
[packages/lirc.git] / lircmd.init
1 #!/bin/sh
2 #
3 # lircmd        Linux Infrared Remote Control mouse daemon
4 #
5 # chkconfig:    2345 92 8
6 # description:  LIRC is a package that allows you to decode and send \
7 #               infra-red signals of many (but not all) commonly used \
8 #               remote controls.
9 #
10 # processname:  lircmd
11 # pidfile:      /var/run/lirc/lircmd.pid
12 # config:       /etc/lirc/lircmd.conf
13
14 # Source function library
15 . /etc/rc.d/init.d/functions
16
17 start() {
18         if [ -f /var/lock/subsys/lircmd ]; then
19                 msg_already_running "Linux Infrared Remote Control mouse daemon"
20                 return
21         fi
22
23         msg_starting "Linux Infrared Remote Control mouse daemon"
24         daemon lircmd
25         RETVAL=$?
26         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/lircmd
27 }
28
29 stop() {
30         if [ ! -f /var/lock/subsys/lircmd ]; then
31                 msg_not_running "Linux Infrared Remote Control mouse daemon"
32                 return
33         fi
34
35         msg_stopping "Linux Infrared Remote Control mouse daemon"
36         killproc lircmd
37         rm -f /var/lock/subsys/lircmd >/dev/null 2>&1
38 }
39
40 condrestart() {
41         if [ ! -f /var/lock/subsys/lircmd ]; then
42                 msg_not_running "Linux Infrared Remote Control mouse daemon"
43                 RETVAL=$1
44                 return
45         fi
46
47         stop
48         start
49 }
50
51 reload() {
52         if [ ! -f /var/lock/subsys/lircmd ]; then
53                 msg_not_running "Linux Infrared Remote Control mouse daemon"
54                 RETVAL=7
55                 return
56         fi
57
58         msg_reloading "Linux Infrared Remote Control mouse daemon"
59         killproc lircmd -HUP
60         RETVAL=$?
61 }
62
63 RETVAL=0
64 # See how we were called.
65 case "$1" in
66   start)
67         start
68         ;;
69   stop)
70         stop
71         ;;
72   restart)
73         stop
74         start
75         ;;
76   try-restart)
77         condrestart 0
78         ;;
79   reload|force-reload)
80         reload
81         ;;
82   status)
83         status lircmd
84         exit $?
85         ;;
86   *)
87         msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
88         exit 3
89         ;;
90 esac
91
92 exit $RETVAL
This page took 0.060152 seconds and 2 git commands to generate.