From 0dc800bbf304bf720e70d15da6c3feda934c2725 Mon Sep 17 00:00:00 2001 From: Reza Behzadan Date: Tue, 6 Feb 2024 08:40:38 +0330 Subject: [PATCH] Update setup.sh to schedule geoip_updater for past two days and today 5 minutes apart --- setup.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/setup.sh b/setup.sh index fadc672..d3f6c76 100755 --- a/setup.sh +++ b/setup.sh @@ -9,8 +9,6 @@ SCRIPT_PATH="/usr/local/bin/$SCRIPT_NAME" GROUP_NAME="geoipusers" LOG_DIR="/var/log" LOG_FILE="$LOG_DIR/geoip_update.log" -CRON_SCHEDULE="0 2 * * *" -CRON_CMD="$SCRIPT_PATH >> $LOG_FILE 2>&1" # Step 1: Ensure the destination directory exists sudo mkdir -p "$DEST_DIR" @@ -32,9 +30,9 @@ sudo chmod +x "$SCRIPT_PATH" # Step 5: Remove existing crontab entries for geoip_updater.sh, then add new # entries for 2 days ago, yesterday, and today crontab -l | grep -v "$SCRIPT_NAME" > /tmp/current_crontab -echo "$CRON_SCHEDULE $SCRIPT_PATH \$(date -I -d '2 days ago') >> $LOG_FILE 2>&1" >> /tmp/current_crontab -echo "$CRON_SCHEDULE $SCRIPT_PATH \$(date -I -d 'yesterday') >> $LOG_FILE 2>&1" >> /tmp/current_crontab -echo "$CRON_SCHEDULE $SCRIPT_PATH \$(date -I -d 'today') >> $LOG_FILE 2>&1" >> /tmp/current_crontab +echo "00 2 * * * $SCRIPT_PATH \$(date -I -d '2 days ago') >> $LOG_FILE 2>&1" >> /tmp/current_crontab +echo "05 2 * * * $SCRIPT_PATH \$(date -I -d 'yesterday') >> $LOG_FILE 2>&1" >> /tmp/current_crontab +echo "10 2 * * * $SCRIPT_PATH \$(date -I -d 'today') >> $LOG_FILE 2>&1" >> /tmp/current_crontab crontab /tmp/current_crontab rm /tmp/current_crontab