diff options
Diffstat (limited to 'app-admin/sysklogd/files/sysklogd.rc6')
-rw-r--r-- | app-admin/sysklogd/files/sysklogd.rc6 | 62 |
1 files changed, 21 insertions, 41 deletions
diff --git a/app-admin/sysklogd/files/sysklogd.rc6 b/app-admin/sysklogd/files/sysklogd.rc6 index 375ba8b87f73..ad817742529b 100644 --- a/app-admin/sysklogd/files/sysklogd.rc6 +++ b/app-admin/sysklogd/files/sysklogd.rc6 @@ -1,12 +1,10 @@ #!/sbin/runscript # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License, v2 or later -# $Header: /var/cvsroot/gentoo-x86/app-admin/sysklogd/files/sysklogd.rc6,v 1.11 2006/05/25 00:54:56 merlin Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-admin/sysklogd/files/sysklogd.rc6,v 1.12 2007/05/01 12:49:04 uberlord Exp $ opts="reload" -opts="start stop reload restart" - depend() { need clock hostname provide logger @@ -14,15 +12,14 @@ depend() { start_daemon() { local retval=0 - local daemon=$1 - local options=$2 + local daemon="$1" + local options="$2" - [[ -z ${daemon} ]] && return 1 - [[ -n ${options} ]] && options="-- ${options}" + [ -z "${daemon}" ] && return 1 ebegin "sysklogd -> start: ${daemon}" - start-stop-daemon --start --quiet --background \ - --exec /usr/sbin/${daemon} ${options} + start-stop-daemon --start --exec /usr/sbin/"${daemon}" \ + --pidfile /var/run/"${daemon}".pid -- ${options} retval=$? eend ${retval} "Failed to start ${daemon}" @@ -31,21 +28,13 @@ start_daemon() { stop_daemon() { local retval=0 - local daemon=$1 - - [[ -z ${daemon} ]] && return 1 + local daemon="$1" - -reload(){ - ebegin "Reloading configuration" - killall -HUP syslogd &>/dev/null - killall -USR2 klogd &> /dev/null - eend $? -} + [ -z "${daemon}" ] && return 1 + ebegin "sysklogd -> stop: ${daemon}" # syslogd can be stubborn some times (--retry 15)... - start-stop-daemon --stop --oknodo --retry 15 \ - --quiet --pidfile /var/run/${daemon}.pid + start-stop-daemon --stop --retry 15 --quiet --pidfile /var/run/"${daemon}".pid retval=$? eend ${retval} "Failed to stop ${daemon}" @@ -58,38 +47,29 @@ start() { # klogd do not always start proper if started too early sleep 1 - start_daemon "klogd" "${KLOGD}" || { - if [[ -n $(pidof syslogd) ]] ; then - stop_daemon "syslogd" - fi + if ! start_daemon "klogd" "${KLOGD}" ; then + stop_daemon "syslogd" return 1 - } + fi return 0 } stop() { stop_daemon "klogd" || return 1 - - # Give klogd time to stop - sleep 1 - - stop_daemon "syslogd" || { - if [[ -n $(pidof syslogd) ]] ; then - # Not sure if we should really try to start - # klogd again ... - start_daemon "klogd" "${KLOGD}" - fi - return 1 - } - + stop_daemon "syslogd" || return 1 return 0 } reload() { local ret=0 + ebegin "Reloading configuration" - killall -HUP syslogd &> /dev/null ; ret=$((ret+$?)) - killall -USR2 klogd &> /dev/null ; ret=$((ret+$?)) + + start-stop-daemon --stop --oknodo --signal HUP --pidfile /var/run/syslogd.pid + ret=$((${ret} + $?)) + start-stop-daemon --stop --oknodo --signal USR1 --pidfile /var/run/klogd.pid + ret=$((${ret} + $?)) + eend ${ret} } |