Skip to content

Commit

Permalink
minor improvement to startup script.
Browse files Browse the repository at this point in the history
  • Loading branch information
jens-maus committed May 25, 2018
1 parent 9219f9b commit bf86b9c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rc.d/hm-watchdog
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ RCDDIR=/usr/local/etc/config/rc.d

start() {
# lets source in the config
if [ -e ${ADDONDIR}/etc/hm-watchdog.conf ]; then
if [[ -e ${ADDONDIR}/etc/hm-watchdog.conf ]]; then
source ${ADDONDIR}/etc/hm-watchdog.conf
else
HM_WATCHDOG_INTERVAL=3
fi

# add or remove our cronjob definitions so that hm-watchdog is executed
# every three minutes
if [ $HM_WATCHDOG_INTERVAL -gt 0 ]; then
if [[ $HM_WATCHDOG_INTERVAL -gt 0 ]]; then
if ! grep -Fq "${ADDONDIR}/bin/hm-watchdog.sh" /usr/local/crontabs/root; then
(crontab -l ; echo "*/${HM_WATCHDOG_INTERVAL} * * * * ${ADDONDIR}/bin/hm-watchdog.sh 2>&1 >/dev/null") 2>&1 | grep -v "no crontab" | sort | uniq | crontab -
(crontab -l ; echo "*/${HM_WATCHDOG_INTERVAL} * * * * ${ADDONDIR}/bin/hm-watchdog.sh >/dev/null 2>/dev/null") 2>&1 | grep -v "no crontab" | sort | uniq | crontab -
fi
else
# remove all cronjob occurances regarding hm-watchdog
Expand Down

0 comments on commit bf86b9c

Please sign in to comment.