aboutsummaryrefslogtreecommitdiffstats
path: root/razerd.initscript
blob: 4080b3f7e6fffb70075af3e4cf55f43fe4530d99 (plain)
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
#!/bin/sh
### BEGIN INIT INFO
# Provides:          razerd
# Required-Start:    $local_fs $remote_fs
# Required-Stop:     $local_fs $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: razerd daemon
# Description:       Razer device state daemon
### END INIT INFO

export PATH="/usr/local/bin:$PATH"
NAME=razerd
DAEMON="$(which $NAME)"
PIDFILE="/run/razerd/razerd.pid"
DESC="Razer device state daemon"

. /lib/lsb/init-functions

case "$1" in
	start)
		log_begin_msg "Starting $DESC: $NAME"
		start-stop-daemon --start --quiet --pidfile $PIDFILE \
			--oknodo --exec "$DAEMON" -- \
			-f -B -P $PIDFILE
		log_end_msg $?
		;;
	stop)
		log_begin_msg "Stopping $DESC: $NAME"
		start-stop-daemon --stop --quiet --pidfile $PIDFILE \
			--name "$NAME"
		RES=$?
		rm -f $PIDFILE
		log_end_msg $RES
		;;
	restart|reload|force-reload)
		$0 stop
		sleep 1
		$0 start
		;;
	*)
		echo "Usage $0 [start|stop|restart|reload|force-reload]"
		exit 1
		;;
esac

exit 0
bues.ch cgit interface