diff options
author | Sean Donner <sean.donner at gmail dot com> | 2010-05-12 17:44:31 +0200 |
---|---|---|
committer | Robby Workman <rworkman@slackbuilds.org> | 2010-05-12 17:44:31 +0200 |
commit | 5931c240a3a8537ad2d5ab38609c845cb2ac66e3 (patch) | |
tree | df820c4c0621473a3f31306738cd98d4b3c52bdb /network/znc/rc.znc | |
parent | 574bf2541ddabf0d04e0e28f22ae84d01b3b784a (diff) |
network/znc: Updated for version 0.062
Diffstat (limited to 'network/znc/rc.znc')
-rw-r--r-- | network/znc/rc.znc | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/network/znc/rc.znc b/network/znc/rc.znc new file mode 100644 index 000000000000..85d58929ceb8 --- /dev/null +++ b/network/znc/rc.znc @@ -0,0 +1,62 @@ +#!/bin/sh + +# Start/stop/restart znc + +# User account under which ZNC should run; only change this if you +# know what you are doing :-) +ZNC_USER="_ZNC_USER_" + +# First, a sanity check +if [[ ! -e /etc/znc/configs/znc.conf ]]; then + echo "Warning: /etc/znc/configs/znc.conf does not exist." + echo "You should create a config file by running the following command:" + echo " su - $ZNC_USER -c '/usr/bin/znc --makeconf --datadir=/etc/znc'" + exit 1 +fi + +znc_start() { + if [[ -e /var/lock/znc ]]; then + echo "ZNC is already running, or there is a stale lock file at " + echo "/var/lock/znc - if you are sure that znc is not already " + echo "running, then remove the lock and try again." + return 1 + else + su - $ZNC_USER -c '/usr/bin/znc --datadir /etc/znc' && touch /var/lock/znc + return 0 + fi +} + +znc_stop() { + killall znc 2>/dev/null + RETVAL=$? + if (( "$RETVAL" != 0 )); then + echo "ZNC does not appear to be running..." + else + rm -f /var/lock/znc + fi + return $RETVAL +} + +znc_restart() { + znc_stop + sleep 1 + znc_start +} + +case "$1" in + 'start') + znc_start + ;; + 'stop') + znc_stop + ;; + 'restart') + znc_restart + ;; + *) + echo "Usage: $0 start|stop|restart" + exit 1 +esac + +exit $? + |