summaryrefslogtreecommitdiffstats
path: root/debian/irker.init
blob: 27ff9cc8b51cfe69bed525f2199266b424a8a3e9 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/sh

### BEGIN INIT INFO
# Provides:		irker
# Required-Start:	$local_fs $remote_fs $syslog $network
# Required-Stop:	$local_fs $remote_fs $syslog $network
# Default-Start:	2 3 4 5
# Default-Stop:   0 1 6
# Short-Description:	submission tools for IRC notifications
# Description:		irkerd is a specialized IRC client that runs as a
#			daemon, allowing other programs to ship IRC
#			notifications by sending JSON objects to a listening
#			socket.
### END INIT INFO

PATH="/sbin:/bin:/usr/sbin:/usr/bin"
DAEMON="/usr/bin/irkerd"

test -x "${DAEMON}" || exit 0

NAME="irkerd"
DESC="IRC notifications"
PIDFILE="/var/run/irker.pid"
DEFAULTS="/etc/default/irker"

for _FILE in "${DEFAULTS}" "${DEFAULTS}".d/*
do
	if [ -e "${_FILE}" ]
	then
		. "${_FILE}"
	fi
done

set -e

. /lib/lsb/init-functions

do_start()
{
	start-stop-daemon --start --background --quiet --oknodo --exec ${DAEMON} --chuid irker -- -l /var/log/irker/irker.log ${IRKER_OPTIONS}
}

do_stop ()
{
	start-stop-daemon --stop --quiet --oknodo --name ${NAME}
}

do_reload ()
{
	start-stop-daemon --stop --quiet --oknodo --name ${NAME} --signal 1
}

case "${1}" in
	start)
		log_daemon_msg "Starting ${DESC}" "${NAME}"
		do_start
		log_end_msg ${?}
		;;

	stop)
		log_daemon_msg "Stopping ${DESC}" "${NAME}"
		do_stop
		log_end_msg ${?}
		;;

	restart|force-reload)
		log_daemon_msg "Restarting ${DESC}" "${NAME}"
		do_stop
		sleep 1
		do_start
		log_end_msg ${?}
		;;

	status)
		status_of_proc ${DAEMON} ${NAME}
		;;

	*)
		echo "Usage: ${0} {start|stop|restart|force-reload|status}" >&2
		exit 1
		;;
esac

exit 0