summaryrefslogtreecommitdiffstats
path: root/znc/init.d/znc
diff options
context:
space:
mode:
Diffstat (limited to 'znc/init.d/znc')
-rwxr-xr-xznc/init.d/znc38
1 files changed, 31 insertions, 7 deletions
diff --git a/znc/init.d/znc b/znc/init.d/znc
index 14b30cd..a8dca9b 100755
--- a/znc/init.d/znc
+++ b/znc/init.d/znc
@@ -3,6 +3,8 @@
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: $
+opts="checkconfig reload"
+
ZNC_USER=${ZNC_USER:-"nobody"}
ZNC_DAEMON=${ZNC_DAEMON:-"/usr/bin/znc"}
@@ -56,16 +58,38 @@ stop() {
eindent
for pidfile in /var/run/znc/* ; do
- pid=$(< ${pidfile})
+ if [ -r ${pidfile} ]; then
+ pid=$(< ${pidfile})
- if [ -L /proc/${pid}/cwd ]; then
- ebegin $(readlink /proc/${pid}/cwd)
+ if [ -L /proc/${pid}/cwd ]; then
+ ebegin $(readlink /proc/${pid}/cwd)
- start-stop-daemon --stop --user ${ZNC_USER} \
- --exec ${ZNC_DAEMON} \
- --pidfile ${pidfile}
+ start-stop-daemon --stop --user ${ZNC_USER} \
+ --exec ${ZNC_DAEMON} \
+ --pidfile ${pidfile}
- eend $?
+ eend $?
+ fi
+ fi
+ done
+
+ eoutdent
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading ZNC"
+ eindent
+
+ for pidfile in /var/run/znc/* ; do
+ if [ -r ${pidfile} ]; then
+ pid=$(< ${pidfile})
+
+ if [ -L /proc/${pid}/cwd ]; then
+ ebegin $(readlink /proc/${pid}/cwd)
+ kill -HUP ${pid}
+ eend $?
+ fi
fi
done