]> git.pld-linux.org Git - packages/lirc.git/blob - lircmd.init
0ef6044ed06a2fb6dfd013acc6dab058cfe350d2
[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_starting "Linux Infrared Remote Control mouse daemon"
20                 daemon lircmd
21                 RETVAL=$?
22                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/lircmd
23         else
24                 msg_already_running "Linux Infrared Remote Control mouse daemon"
25         fi
26 }
27
28 stop() {
29         if [ -f /var/lock/subsys/lircmd ]; then
30                 msg_stopping "Linux Infrared Remote Control mouse daemon"
31                 killproc lircmd
32                 rm -f /var/lock/subsys/lircmd >/dev/null 2>&1
33         else
34                 msg_not_running "Linux Infrared Remote Control mouse daemon"
35         fi
36 }
37
38 condrestart() {
39         if [ -f /var/lock/subsys/lircmd ]; then
40                 stop
41                 start
42         else
43                 msg_not_running "Linux Infrared Remote Control mouse daemon"
44                 RETVAL=$1
45         fi
46 }
47
48 RETVAL=0
49 # See how we were called.
50 case "$1" in
51   start)
52         start
53         ;;
54   stop)
55         stop
56         ;;
57   restart)
58         stop
59         start
60         ;;
61   try-restart)
62         condrestart 0
63         ;;
64   reload|force-reload)
65         if [ -f /var/lock/subsys/lircmd ]; then
66                 msg_reloading "Linux Infrared Remote Control mouse daemon"
67                 killproc lircmd -HUP
68                 RETVAL=$?
69         else
70                 msg_not_running "Linux Infrared Remote Control mouse daemon" >&2
71                 exit 7
72         fi
73         ;;
74   status)
75         status lircmd
76         exit $?
77         ;;
78   *)
79         msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
80         exit 3
81         ;;
82 esac
83
84 exit $RETVAL
This page took 0.058119 seconds and 2 git commands to generate.