mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 17:50:20 +00:00
Enables salt-minion watchdog on init.d script for sysV
This commit is contained in:
parent
4257ba5af9
commit
30b12da58b
1 changed files with 21 additions and 2 deletions
23
pkg/suse/salt-minion
Normal file → Executable file
23
pkg/suse/salt-minion
Normal file → Executable file
|
@ -51,8 +51,23 @@ SERVICE=salt-minion
|
|||
PROCESS=salt-minion
|
||||
|
||||
RETVAL=0
|
||||
WATCHDOG_CRON="/etc/cron.d/salt-minion"
|
||||
|
||||
set_watchdog() {
|
||||
if [ ! -f $WATCHDOG_CRON ]; then
|
||||
echo -e '* * * * * root /usr/bin/salt-daemon-watcher --with-init\n' > $WATCHDOG_CRON
|
||||
# Kick the watcher for 1 minute immediately, because cron will wake up only afterwards
|
||||
/usr/bin/salt-daemon-watcher --with-init & disown
|
||||
fi
|
||||
}
|
||||
|
||||
remove_watchdog() {
|
||||
rm $WATCHDOG_CRON 2>/dev/null || true
|
||||
kill -9 $(ps uax | grep [s]alt-daemon-watcher | awk '{print $2}') 2>/dev/null
|
||||
}
|
||||
|
||||
start() {
|
||||
set_watchdog;
|
||||
echo -n $"Starting salt-minion daemon: "
|
||||
if [ -f $SUSE_RELEASE ]; then
|
||||
startproc -p /var/run/$SERVICE.pid $SALTMINION -d $MINION_ARGS
|
||||
|
@ -80,6 +95,10 @@ start() {
|
|||
}
|
||||
|
||||
stop() {
|
||||
IS_RESTARTING=$1
|
||||
if [ -z $IS_RESTARTING ]; then
|
||||
remove_watchdog;
|
||||
fi
|
||||
echo -n $"Stopping salt-minion daemon: "
|
||||
if [ -f $SUSE_RELEASE ]; then
|
||||
killproc -TERM $SALTMINION
|
||||
|
@ -101,8 +120,8 @@ stop() {
|
|||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
stop 1;
|
||||
start;
|
||||
}
|
||||
|
||||
# See how we were called.
|
||||
|
|
Loading…
Add table
Reference in a new issue