File: lirc.lircd.init

package info (click to toggle)
lirc 0.10.1-6
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 8,364 kB
  • sloc: ansic: 26,717; cpp: 9,066; sh: 5,521; python: 4,362; makefile: 1,034; xml: 63
file content (64 lines) | stat: -rw-r--r-- 1,625 bytes parent folder | download | duplicates (3)
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
#!/bin/sh
### BEGIN INIT INFO
# Provides:          lircd
# Required-Start:    $local_fs $remote_fs $syslog
# Required-Stop:     $local_fs $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Starts the LIRCD daemon.
# Description:       LIRC is used to control different
#                    infrared receivers and transceivers.
### END INIT INFO

# source generic LSB initscript helpers
. /lib/lsb/init-functions

# check if the lirc package is still installed and this not a stale conffile
test -x /usr/sbin/lircd  || exit 0

# sanity checks for starting lircd
if [ ! -f /etc/lirc/lircd.conf ] || \
   [ "$(grep -v -e ^[\ \t]*\# -e ^$ /etc/lirc/lircd.conf | wc -l)" -eq 0 ]; then
	exit 0
fi


case "$1" in
	start)
		# start lircd
		[ -d "/run/lirc" ] || mkdir -p "/run/lirc"

		log_daemon_msg "Starting remote control daemon" "LIRCD"
		start-stop-daemon --start --quiet --oknodo \
			--exec /usr/sbin/lircd -- < /dev/null
		log_end_msg $?

		# retain compatibility with old clients
		ln -fs /run/lirc/lircd /dev/lircd
		;;
	stop)
		log_daemon_msg "Stopping remote control daemon" "LIRCD"
		start-stop-daemon --stop --quiet \
			--exec /usr/sbin/lircd
		log_end_msg $?
		;;
	reload|force-reload)
		log_daemon_msg "Reload configuration for remote control daemon" "LIRCD"
		start-stop-daemon --stop --quiet --signal 1 \
			--exec /usr/sbin/lircd
		log_end_msg $?
		;;
	restart)
		$0 stop
		$0 start
		;;
	status)
		status_of_proc /usr/sbin/lircd lircd   || exit $?
		;;
	*)
		echo "Usage: /etc/init.d/lircd {start|stop|reload|restart|force-reload|status}"
		exit 1
		;;
esac

exit 0