Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- ### BEGIN INIT INFO
- # Provides: salt-master
- # Required-Start: $remote_fs $network
- # Required-Stop: $remote_fs $network
- # Default-Start: 2 3 4 5
- # Default-Stop: 0 1 6
- # Short-Description: salt master control daemon
- # Description: This is a daemon that controls the salt minions
- ### END INIT INFO
- # Author: Michael Prokop <mika@debian.org> Franklin G. Mendoza <franklin.g.mendoza@gmail.com>
- PATH=/sbin:/usr/sbin:/bin:/usr/bin
- DESC="salt master control daemon"
- NAME="salt-master"
- DAEMON=/usr/bin/salt-master
- DAEMON_ARGS="-d"
- PIDFILE=/var/run/$NAME.pid
- SCRIPTNAME=/etc/init.d/$NAME
- # Exit if the package is not installed
- [ -x "$DAEMON" ] || exit 0
- # Read configuration variable file if it is present
- [ -r /etc/default/$NAME ] && . /etc/default/$NAME
- . /lib/init/vars.sh
- . /lib/lsb/init-functions
- case "$1" in
- start)
- #pid=$(pidofproc -p $PIDFILE $DAEMON)
- #if [ -n "$pid" ]; then
- # log_daemon_msg "$NAME daemon is already running"
- # exit 0
- #fi
- log_daemon_msg "Starting $DESC: $NAME."
- if ! start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_ARGS; then
- log_end_msg 1
- exit 1
- fi
- log_end_msg 0
- ;;
- stop)
- log_daemon_msg "Stopping $DESC: $NAME."
- start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $PIDFILE
- ;;
- restart|force-reload)
- log_daemon_msg "Restarting $DESC: $NAME. "
- start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $PIDFILE
- start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_ARGS
- ;;
- status)
- status_of_proc "$DAEMON" "$NAME" || exit 0
- ;;
- *)
- echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
- exit 3
- ;;
- esac
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement