From 678fab2977da754371be2b3fabfe0264ff6bcb53 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Fri, 17 Dec 2010 14:38:33 +0100 Subject: znc: added reload function to reload the config on the fly --- znc/init.d/znc | 38 +++++++++++++++++++++++++++++++------- 1 file 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 -- cgit v1.2.3