Skip to content

Instantly share code, notes, and snippets.

@vicendominguez
Created September 9, 2015 11:21
Show Gist options
  • Save vicendominguez/254c60e853aa577100df to your computer and use it in GitHub Desktop.
Save vicendominguez/254c60e853aa577100df to your computer and use it in GitHub Desktop.
smokeping init.d script for staves on CentOS
#! /bin/sh
#
# chkconfig: - 70 30
# description: latency logging and graphing system
# processname: smokeping
# Source function library.
. /etc/rc.d/init.d/functions
# Get config.
. /etc/sysconfig/network
# Check that networking is up.
if [ "$NETWORKING" = "no" ]
then
exit 0
fi
#For slave config uncomment
#change the "--master" url please
SLAVE_OPT="--master-url=https://smokeping.net/smokeping/smokeping.cgi --cache-dir=/var/smokeping/ --shared-secret=/etc/smokeping/secret.txt"
RETVAL=0
prog='smokeping'
lockfile=${LOCKFILE-/var/lock/subsys/smokeping}
start() {
echo -n $"Starting $prog: "
daemon $prog $SLAVE_OPT
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch ${lockfile}
}
stop() {
echo -n $"Stopping $prog: "
killproc $prog
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f ${lockfile}
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $prog
;;
restart|reload)
stop
start
;;
condrestart)
[ -f ${lockfile} ] && restart || :
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
exit 1
esac
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment