From 13aeffacf1f7c125e1b390166e02af185bffcb52 Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Tue, 13 Feb 2024 12:46:49 -0500 Subject: [PATCH 1/2] Added exit on bad crontab --- scripts/start.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/start.sh b/scripts/start.sh index 80ccfeebc..df77be94b 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -99,16 +99,19 @@ rm -f "/home/steam/server/crontab" if [ "${BACKUP_ENABLED,,}" = true ]; then echo "BACKUP_ENABLED=${BACKUP_ENABLED,,}" echo "$BACKUP_CRON_EXPRESSION bash /usr/local/bin/backup" >> "/home/steam/server/crontab" + supercronic -quiet -test "/home/steam/server/crontab" || exit fi if [ "${AUTO_UPDATE_ENABLED,,}" = true ] && [ "${UPDATE_ON_BOOT}" = true ]; then echo "AUTO_UPDATE_ENABLED=${AUTO_UPDATE_ENABLED,,}" echo "$AUTO_UPDATE_CRON_EXPRESSION bash /usr/local/bin/update" >> "/home/steam/server/crontab" + supercronic -quiet -test "/home/steam/server/crontab" || exit fi if [ "${AUTO_REBOOT_ENABLED,,}" = true ] && [ "${RCON_ENABLED,,}" = true ]; then echo "AUTO_REBOOT_ENABLED=${AUTO_REBOOT_ENABLED,,}" echo "$AUTO_REBOOT_CRON_EXPRESSION bash /home/steam/server/auto_reboot.sh" >> "/home/steam/server/crontab" + supercronic -quiet -test "/home/steam/server/crontab" || exit fi if { [ "${AUTO_UPDATE_ENABLED,,}" = true ] && [ "${UPDATE_ON_BOOT,,}" = true ]; } || [ "${BACKUP_ENABLED,,}" = true ] || \ From 81493759daf0e8b1d8854bbcee3d044873a0ae50 Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Tue, 13 Feb 2024 12:54:03 -0500 Subject: [PATCH 2/2] Added echo statements --- scripts/start.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/start.sh b/scripts/start.sh index df77be94b..5457b6ea8 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -95,21 +95,26 @@ else /home/steam/server/compile-settings.sh fi +printf "\e[0;32m%s\e[0m\n" "*****GENERATING CRONTAB*****" + rm -f "/home/steam/server/crontab" if [ "${BACKUP_ENABLED,,}" = true ]; then echo "BACKUP_ENABLED=${BACKUP_ENABLED,,}" + echo "Adding cronjob for auto backups" echo "$BACKUP_CRON_EXPRESSION bash /usr/local/bin/backup" >> "/home/steam/server/crontab" supercronic -quiet -test "/home/steam/server/crontab" || exit fi if [ "${AUTO_UPDATE_ENABLED,,}" = true ] && [ "${UPDATE_ON_BOOT}" = true ]; then echo "AUTO_UPDATE_ENABLED=${AUTO_UPDATE_ENABLED,,}" + echo "Adding cronjob for auto updating" echo "$AUTO_UPDATE_CRON_EXPRESSION bash /usr/local/bin/update" >> "/home/steam/server/crontab" supercronic -quiet -test "/home/steam/server/crontab" || exit fi if [ "${AUTO_REBOOT_ENABLED,,}" = true ] && [ "${RCON_ENABLED,,}" = true ]; then echo "AUTO_REBOOT_ENABLED=${AUTO_REBOOT_ENABLED,,}" + echo "Adding cronjob for auto rebooting" echo "$AUTO_REBOOT_CRON_EXPRESSION bash /home/steam/server/auto_reboot.sh" >> "/home/steam/server/crontab" supercronic -quiet -test "/home/steam/server/crontab" || exit fi @@ -117,6 +122,9 @@ fi if { [ "${AUTO_UPDATE_ENABLED,,}" = true ] && [ "${UPDATE_ON_BOOT,,}" = true ]; } || [ "${BACKUP_ENABLED,,}" = true ] || \ [ "${AUTO_REBOOT_ENABLED,,}" = true ]; then supercronic "/home/steam/server/crontab" & + echo "Cronjobs started" +else + echo "No Cronjobs found" fi # Configure RCON settings