fix: no crontab is added repeatedly on restart

(fixed #1, fixed #3)
This commit is contained in:
ttionya
2020-10-07 21:15:53 +08:00
parent 1b9fe66e16
commit 7e437a1884
+4 -1
View File
@@ -26,7 +26,10 @@ if [[ "$1" == "mail" ]]; then
fi
function configure_cron() {
echo "${CRON} sh /app/backup.sh > /dev/stdout" >> /etc/crontabs/root
local FIND_CRON_COUNT=$(crontab -l | grep -c 'backup.sh')
if [[ ${FIND_CRON_COUNT} -eq 0 ]]; then
echo "${CRON} sh /app/backup.sh > /dev/stdout" >> /etc/crontabs/root
fi
}
init_env