Advertisement
Guest User

salt-master's init script

a guest
Apr 16th, 2013
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.83 KB | None | 0 0
  1. #!/bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:          salt-master
  4. # Required-Start:    $remote_fs $network
  5. # Required-Stop:     $remote_fs $network
  6. # Default-Start:     2 3 4 5
  7. # Default-Stop:      0 1 6
  8. # Short-Description: salt master control daemon
  9. # Description:       This is a daemon that controls the salt minions
  10. ### END INIT INFO
  11.  
  12. # Author: Michael Prokop <mika@debian.org> Franklin G. Mendoza <franklin.g.mendoza@gmail.com>
  13.  
  14. PATH=/sbin:/usr/sbin:/bin:/usr/bin
  15. DESC="salt master control daemon"
  16. NAME="salt-master"
  17. DAEMON=/usr/bin/salt-master
  18. DAEMON_ARGS="-d"
  19. PIDFILE=/var/run/$NAME.pid
  20. SCRIPTNAME=/etc/init.d/$NAME
  21.  
  22. # Exit if the package is not installed
  23. [ -x "$DAEMON" ] || exit 0
  24.  
  25. # Read configuration variable file if it is present
  26. [ -r /etc/default/$NAME ] && . /etc/default/$NAME
  27.  
  28. . /lib/init/vars.sh
  29. . /lib/lsb/init-functions
  30.  
  31.  
  32. case "$1" in
  33.      start)
  34.  
  35.     #pid=$(pidofproc -p $PIDFILE $DAEMON)
  36.  
  37.     #if [ -n "$pid" ]; then
  38.     #   log_daemon_msg "$NAME daemon is already running"
  39.         #   exit 0
  40.         #fi
  41.    
  42.     log_daemon_msg "Starting $DESC: $NAME."
  43.    
  44.     if ! start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_ARGS; then
  45.               log_end_msg 1
  46.               exit 1
  47.         fi
  48.  
  49.     log_end_msg 0
  50.  
  51.         ;;
  52.      stop)
  53.     log_daemon_msg "Stopping $DESC: $NAME."
  54.     start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $PIDFILE
  55.         ;;
  56.      restart|force-reload)
  57.     log_daemon_msg "Restarting $DESC: $NAME. "
  58.     start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $PIDFILE
  59.     start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_ARGS
  60.         ;;
  61.      status)
  62.     status_of_proc "$DAEMON" "$NAME" || exit 0
  63.     ;;
  64.      *)
  65.         echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
  66.         exit 3
  67.         ;;
  68. esac
  69.  
  70. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement