summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2010-12-17 14:38:33 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2010-12-17 14:38:33 +0100
commit678fab2977da754371be2b3fabfe0264ff6bcb53 (patch)
tree929c583b2ce17f29dc24900236646c38b4c1d261
parent6793f3f5743c4a1b46864c92b3559a52eae1f8a9 (diff)
downloadstartscripts-678fab2977da754371be2b3fabfe0264ff6bcb53.tar.gz
startscripts-678fab2977da754371be2b3fabfe0264ff6bcb53.tar.xz
startscripts-678fab2977da754371be2b3fabfe0264ff6bcb53.zip
znc: added reload function to reload the config on the fly
-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