Dago_O

Smokeping salve server init script

Jun 7th, 2013
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.30 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # chkconfig: 2345 80 05
  4. # Description: Smokeping init.d script
  5.  
  6. # Get function from functions library
  7. . /etc/init.d/functions
  8.  
  9. # Start the service Smokeping
  10. start() {
  11.         echo -n "Starting Smokeping: "
  12.         /opt/smokeping/bin/smokeping --master-url=http://<your-slave-server>/smokeping/index.cgi --cache-dir=/opt/smokeping/var/ --shared-secret=/opt/smokeping/var/secret.txt --logfile=/var/log/smokeping.log --slave-name=<your-slave-server-name> > /dev/null 2>&1
  13.         ### Create the lock file ###
  14.         touch /var/lock/subsys/smokeping
  15.         success $"Smokeping startup"
  16.         echo
  17. }
  18.  
  19. # Restart the service Smokeping
  20. stop() {
  21.         echo -n "Stopping Smokeping: "
  22.         kill -9 `ps ax | grep "/opt/smokeping/bin/smokeping" | grep -v grep | awk '{ print $1 }'` >/dev/null 2>&1 && killall speedy_backend
  23.         ### Now, delete the lock file ###
  24.         rm -f /var/lock/subsys/smokeping
  25.         success $"Smokeping shutdown"
  26.         echo
  27. }
  28.  
  29. ### main logic ###
  30. case "$1" in
  31.   start)
  32.         start
  33.         ;;
  34.   stop)
  35.         stop
  36.         ;;
  37.   status)
  38.         status Smokeping
  39.         ;;
  40.   restart|reload|condrestart)
  41.         stop
  42.         start
  43.         ;;
  44.   *)
  45.         echo $"Usage: $0 {start|stop|restart|reload|status}"
  46.         exit 1
  47. esac
  48.  
  49. exit 0
Add Comment
Please, Sign In to add comment