summaryrefslogtreecommitdiff
path: root/initrc/znc
diff options
context:
space:
mode:
Diffstat (limited to 'initrc/znc')
-rwxr-xr-xinitrc/znc37
1 files changed, 37 insertions, 0 deletions
diff --git a/initrc/znc b/initrc/znc
new file mode 100755
index 0000000..7f7bcb0
--- /dev/null
+++ b/initrc/znc
@@ -0,0 +1,37 @@
+#!/bin/bash
+set -e
+
+USER="horus"
+DATADIR="/home/${USER}/.znc"
+NAME=znc
+DESC="ZNC, the IRC Bouncer"
+
+DAEMON="/usr/bin/znc"
+DAEMON_OPTS="--foreground --datadir=$DATADIR"
+
+PIDFILE="/var/run/${NAME}.pid"
+
+START_OPTS="--start --background --make-pidfile --pidfile ${PIDFILE} --chuid $USER"
+END_OPTS="--stop --pidfile ${PIDFILE}"
+
+case "$1" in
+ start)
+ echo "Starting ${DESC}"
+ start-stop-daemon $START_OPTS --exec ${DAEMON} -- $DAEMON_OPTS
+ ;;
+ stop)
+ echo "Stopping ${DESC}"
+ start-stop-daemon $END_OPTS
+ rm -f "${PIDFILE}"
+ ;;
+ restart)
+ "$0" stop
+ rm -f "${PIDFILE}"
+ sleep 1
+ "$0" start
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart}"
+ exit 1
+ ;;
+esac