summaryrefslogtreecommitdiffstats
path: root/debian/irker.init
diff options
context:
space:
mode:
Diffstat (limited to 'debian/irker.init')
-rw-r--r--debian/irker.init84
1 files changed, 84 insertions, 0 deletions
diff --git a/debian/irker.init b/debian/irker.init
new file mode 100644
index 0000000..27ff9cc
--- /dev/null
+++ b/debian/irker.init
@@ -0,0 +1,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