summaryrefslogtreecommitdiffstats
path: root/system/salt/rc.salt-minion.new
diff options
context:
space:
mode:
Diffstat (limited to 'system/salt/rc.salt-minion.new')
-rw-r--r--system/salt/rc.salt-minion.new49
1 files changed, 49 insertions, 0 deletions
diff --git a/system/salt/rc.salt-minion.new b/system/salt/rc.salt-minion.new
new file mode 100644
index 0000000000..f699a12f25
--- /dev/null
+++ b/system/salt/rc.salt-minion.new
@@ -0,0 +1,49 @@
+#!/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