From: <buc...@us...> - 2011-01-25 12:05:25
|
Revision: 213 http://devmon.svn.sourceforge.net/devmon/?rev=213&view=rev Author: buchanmilne Date: 2011-01-25 12:05:18 +0000 (Tue, 25 Jan 2011) Log Message: ----------- Add LSB headers to init script Improvements to init script for RHEL4 and older Modified Paths: -------------- trunk/extras/devmon.initd.redhat Modified: trunk/extras/devmon.initd.redhat =================================================================== --- trunk/extras/devmon.initd.redhat 2011-01-25 09:19:43 UTC (rev 212) +++ trunk/extras/devmon.initd.redhat 2011-01-25 12:05:18 UTC (rev 213) @@ -1,4 +1,12 @@ #!/bin/bash +### BEGIN INIT INFO +# Provides: devmon +# Should-Start: $network +# Should-Stop: $network +# Default-Start: 345 +# Short-Description: Starts the Devmon SNMP data collector for Xymon/Hobbit +# Description: This startup script launches Devmon SNMP collector for Xymon/Hobbit +### END INIT INFO # # chkconfig: 2345 90 10 # description: An snmp data collector for the hobbit & BigBrother network @@ -42,7 +50,7 @@ # is a copy of the killproc that has the options we need # otherwise we use the killproc we have - if killproc -p $PIDFILE -d $KILLDELAY devmon -0 >/dev/null + if killproc -p $PIDFILE -d $KILLDELAY devmon -0 >/dev/null 2>/dev/null then killproc -p $PIDFILE -d $KILLDELAY devmon else internal_killproc -p $PIDFILE -d $KILLDELAY devmon fi @@ -52,13 +60,36 @@ } rotate () { - if killproc -p $PIDFILE -d $KILLDELAY devmon -0 >/dev/null + if killproc -p $PIDFILE -d $KILLDELAY devmon -0 >/dev/null 2>/dev/null then killproc -p $PIDFILE -d $KILLDELAY devmon -HUP >/dev/null else internal_killproc -p $PIDFILE -d $KILLDELAY devmon -HUP >/dev/null fi RETVAL=$? } +# __proc_pids {program} [pidfile] +# Set $pid to pids from /var/run* for {program}. $pid should be declared +# local in the caller. +# Returns LSB exit code for the 'status' action. +__pids_var_run() { + local base=${1##*/} + local pid_file=${2:-/var/run/$base.pid} + + pid= + if [ -f "$pid_file" ] ; then + local line p + read line < "$pid_file" + for p in $line ; do + [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && pid="$pid $p" + done + if [ -n "$pid" ]; then + return 0 + fi + return 1 # "Program is dead and /var/run pid file exists" + fi + return 3 # "Program is not running" +} + internal_killproc() { local RC killlevel= base pid pid_file= delay This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |