Test daemon running state the systemd way

This commit is contained in:
Bob Mottram 2017-06-11 10:22:32 +01:00
parent 5cf9fdd93e
commit 2bc2c38db6
1 changed files with 1 additions and 1 deletions

View File

@ -54,7 +54,7 @@ function add_watchdog_daemon {
echo '' >> /usr/bin/$WATCHDOG_SCRIPT_NAME echo '' >> /usr/bin/$WATCHDOG_SCRIPT_NAME
echo "# keep ${daemon_name} daemon running" >> /usr/bin/$WATCHDOG_SCRIPT_NAME echo "# keep ${daemon_name} daemon running" >> /usr/bin/$WATCHDOG_SCRIPT_NAME
echo "RUNNING=\$(pgrep ${daemon_name} > /dev/null && echo Running)" >> /usr/bin/$WATCHDOG_SCRIPT_NAME echo "RUNNING=\$(systemctl is-active ${daemon_name} >/dev/null 2>&1 && echo Running)" >> /usr/bin/$WATCHDOG_SCRIPT_NAME
echo 'if [ ! $RUNNING ]; then' >> /usr/bin/$WATCHDOG_SCRIPT_NAME echo 'if [ ! $RUNNING ]; then' >> /usr/bin/$WATCHDOG_SCRIPT_NAME
echo " systemctl start ${daemon_name}" >> /usr/bin/$WATCHDOG_SCRIPT_NAME echo " systemctl start ${daemon_name}" >> /usr/bin/$WATCHDOG_SCRIPT_NAME
echo ' echo -n $CURRENT_DATE >> $LOGFILE' >> /usr/bin/$WATCHDOG_SCRIPT_NAME echo ' echo -n $CURRENT_DATE >> $LOGFILE' >> /usr/bin/$WATCHDOG_SCRIPT_NAME