summaryrefslogtreecommitdiffhomepage
path: root/debug-me.init
blob: fd115315b8c6d155541ece3188b1d8beed184567 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/sh

### BEGIN INIT INFO
# Provides:          debug-me
# Required-Start:    $network $remote_fs
# Required-Stop:     $network $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: debug-me server
# Description: Starts debug-me in server mode
### END INIT INFO

PATH=/bin:/usr/bin:/sbin:/usr/sbin
NAME=debug-me
DESC="debug-me server"
DAEMON="/usr/bin/debug-me"
PIDFILE=/var/run/"$NAME".pid

test -x /usr/bin/debug-me || exit 0

. /lib/lsb/init-functions

# Parameters to pass to debug-me.
# This can be overridden in /etc/default/debug-me
DAEMON_PARAMS="--server /var/log/debug-me/ --delete-old-logs"
if [ -e /etc/default/debug-me ]; then
	. /etc/default/debug-me
fi

case "$1" in
	start)
		log_daemon_msg "Starting $DESC" "$NAME"
		start-stop-daemon --start --quiet --oknodo \
			--background --no-close \
			--pidfile "$PIDFILE" --make-pidfile \
			--chuid debug-me:debug-me \
			--exec "$DAEMON" -- $DAEMON_PARAMS \
			> /var/log/debug-me.log
		log_end_msg $?
	;;
	stop)
		log_daemon_msg "Stopping $DESC" "$NAME"
		killproc -p "$PIDFILE" "$DAEMON"
		RETVAL=$?
		[ $RETVAL -eq 0 ] && [ -e "$PIDFILE" ] && rm -f $PIDFILE
		log_end_msg $RETVAL
		;;
	restart|reload|force-reload)
		log_daemon_msg "Restarting $DESC" "$NAME"
		$0 stop
		$0 start
		;;
	status)
		status_of_proc -p $PIDFILE "$DAEMON" "$NAME" && exit 0 || exit $?
		;;
	*)
		log_action_msg "Usage: /etc/init.d/debug-me {start|stop|status|restart|reload|force-reload}"
		exit 2
		;;
esac
exit 0