Dago_O

Smokeping master server init script

Jun 7th, 2013
77
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [root@netman-iqq ~]# cat /etc/init.d/smokeping
  2. #!/bin/bash
  3. #
  4. # chkconfig: 2345 80 05
  5. # Description: Smokeping init.d script
  6.  
  7. # Get function from functions library
  8. . /etc/init.d/functions
  9.  
  10. # Start the service Smokeping
  11. start() {
  12.         echo -n "Starting Smokeping: "
  13.         /opt/smokeping/bin/smokeping --debug-daemon > /dev/null 2>&1
  14.         ### Create the lock file ###
  15.         touch /var/lock/subsys/smokeping
  16.         success $"Smokeping startup"
  17.         echo
  18. }
  19.  
  20. # Restart the service Smokeping
  21. stop() {
  22.         echo -n "Stopping Smokeping: "
  23.         kill -9 `ps ax | grep "/opt/smokeping/bin/smokeping" | grep -v grep | awk '{ print $1 }'` >/dev/null 2>&1 && killall speedy_backend
  24.         ### Now, delete the lock file ###
  25.         rm -f /var/lock/subsys/smokeping
  26.         success $"Smokeping shutdown"
  27.         echo
  28. }
  29.  
  30. ### main logic ###
  31. case "$1" in
  32.   start)
  33.         start
  34.         ;;
  35.   stop)
  36.         stop
  37.         ;;
  38.   status)
  39.         status Smokeping
  40.         ;;
  41.   restart|reload|condrestart)
  42.         stop
  43.         start
  44.         ;;
  45.   *)
  46.         echo $"Usage: $0 {start|stop|restart|reload|status}"
  47.         exit 1
  48. esac
  49.  
  50. exit 0
RAW Paste Data