Changes of Revision 30
[-] [+] | Changed | smokeping.spec |
[-] [+] | Added | smokeping.init.rh ^ |
@@ -0,0 +1,93 @@ +#!/bin/sh +# +# chkconfig: - 86 14 +# description: smokeping init script +# processname: smokeping +# config: /etc/smokeping/config +# pidfile: /var/run/smokeping/smokeping.pid + +# Source function library. +. /etc/rc.d/init.d/functions + +# the path to your PID file +# path to smokeping script +smokeping=/usr/bin/smokeping +smokeping_config=/etc/smokeping/config +smokeping_logfile=/var/log/smokeping/smokeping.log +pidfile=/var/run/smokeping/smokeping.pid +lockfile=/var/lock/subsys/smokeping +smokeping_opts="--config=${smokeping_config} --logfile=${smokeping_logfile}" +prog=smokeping +run_user=smokeping +RETVAL=0 +STOP_TIMEOUT=10 + +start() { + echo -n $"Starting $prog: " + daemon --pidfile=${pidfile} --user $run_user $smokeping $smokeping_opts + RETVAL=$? + echo + [ $RETVAL = 0 ] && touch ${lockfile} + return $RETVAL +} + +stop() { + echo -n $"Stopping $prog: " + killproc -p ${pidfile} -d ${STOP_TIMEOUT} $smokeping + RETVAL=$? + echo + [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile} +} + +reload() { + echo -n $"Reloading $prog: " + if ! $smokeping $smokeping_opts --check >&/dev/null; then + echo $"not reloading due to configuration syntax error" + failure $"not reloading $smokeping due to configuration syntax error" + else + $smokeping $smokeping_opts --reload + RETVAL=$? + if [ $RETVAL -ne 0 ]; then + failure $"smokeping reloading" + fi + fi + echo +} + +restart() { + echo -n $"Restarting $prog: " + if ! $smokeping $smokeping_opts --check >&/dev/null; then + echo $"not restarting due to configuration syntax error" + failure $"not restarting $smokeping due to configuration syntax error" + else + $smokeping $smokeping_opts --restart + RETVAL=$? + if [ $RETVAL -ne 0 ]; then + failure $"smokeping restarting" + fi + fi + echo +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status -p ${pidfile} $smokeping + RETVAL=$? + ;; + reload) + reload + ;; + restart) + restart + ;; + *) + echo $"Usage: $prog {start|stop|restart|reload|status}" + RETVAL=2 +esac | ||
[-] [+] | Added | smokeping.logrotate ^ |
@@ -0,0 +1,7 @@ +/var/log/smokeping/smokeping.log { + daily + rotate 7 + missingok + compress + notifempty +} |