mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-25 10:03:03 +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 minion
|
|
|
|
PIDFILE=/var/run/salt-minion.pid
|
|
LOGFILE=/var/log/salt/minion
|
|
# LOGLEVEL: One of: all, garbage, trace, debug, info, warning, error, quiet
|
|
LOGLEVEL=warning
|
|
|
|
# Start salt-minion:
|
|
salt_minion_start() {
|
|
if [ -x /usr/bin/salt-minion ]; then
|
|
echo "Starting salt-minion daemon: /usr/bin/salt-minion"
|
|
/usr/bin/salt-minion -d \
|
|
--pid-file=$PIDFILE \
|
|
--log-file=$LOGFILE \
|
|
--log-file-level=$LOGLEVEL
|
|
fi
|
|
}
|
|
|
|
# Stop salt-minion:
|
|
salt_minion_stop() {
|
|
if [ -s $PIDFILE ] ; then
|
|
kill $(cat $PIDFILE)
|
|
else
|
|
killall salt-minion
|
|
fi
|
|
rm -f $PIDFILE
|
|
}
|
|
|
|
# Restart salt-minion:
|
|
salt_minion_restart() {
|
|
salt_minion_stop
|
|
sleep 1
|
|
salt_minion_start
|
|
}
|
|
|
|
case "$1" in
|
|
'start')
|
|
salt_minion_start
|
|
;;
|
|
'stop')
|
|
salt_minion_stop
|
|
;;
|
|
'restart')
|
|
salt_minion_restart
|
|
;;
|
|
*)
|
|
echo "usage $0 start|stop|restart"
|
|
esac
|