mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-26 22:06:35 +01:00
206336c0bc
Thanks to bjwebb. Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
49 lines
882 B
Bash
49 lines
882 B
Bash
#!/bin/sh
|
|
# Start/stop/restart salt master
|
|
|
|
PIDFILE=/var/run/salt-master.pid
|
|
LOGFILE=/var/log/salt/master
|
|
# LOGLEVEL: One of: all, garbage, trace, debug, info, warning, error, quiet
|
|
LOGLEVEL=warning
|
|
|
|
# Start salt-master:
|
|
salt_master_start() {
|
|
if [ -x /usr/bin/salt-master ]; then
|
|
echo "Starting salt-master daemon: /usr/bin/salt-master"
|
|
/usr/bin/salt-master -d \
|
|
--pid-file=$PIDFILE \
|
|
--log-file=$LOGFILE \
|
|
--log-file-level=$LOGLEVEL
|
|
fi
|
|
}
|
|
|
|
# Stop salt-master:
|
|
salt_master_stop() {
|
|
if [ -s $PIDFILE ] ; then
|
|
kill $(cat $PIDFILE)
|
|
else
|
|
killall salt-master
|
|
fi
|
|
rm -f $PIDFILE
|
|
}
|
|
|
|
# Restart salt-master:
|
|
salt_master_restart() {
|
|
salt_master_stop
|
|
sleep 1
|
|
salt_master_start
|
|
}
|
|
|
|
case "$1" in
|
|
'start')
|
|
salt_master_start
|
|
;;
|
|
'stop')
|
|
salt_master_stop
|
|
;;
|
|
'restart')
|
|
salt_master_restart
|
|
;;
|
|
*)
|
|
echo "usage $0 start|stop|restart"
|
|
esac
|