Update setup.sh to schedule geoip_updater for past two days and today 5 minutes apart
This commit is contained in:
		
							parent
							
								
									61025d0994
								
							
						
					
					
						commit
						0dc800bbf3
					
				
							
								
								
									
										8
									
								
								setup.sh
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								setup.sh
									
									
									
									
									
								
							| @ -9,8 +9,6 @@ SCRIPT_PATH="/usr/local/bin/$SCRIPT_NAME" | |||||||
| GROUP_NAME="geoipusers" | GROUP_NAME="geoipusers" | ||||||
| LOG_DIR="/var/log" | LOG_DIR="/var/log" | ||||||
| LOG_FILE="$LOG_DIR/geoip_update.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 | # Step 1: Ensure the destination directory exists | ||||||
| sudo mkdir -p "$DEST_DIR" | 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 | # Step 5: Remove existing crontab entries for geoip_updater.sh, then add new | ||||||
| #         entries for 2 days ago, yesterday, and today | #         entries for 2 days ago, yesterday, and today | ||||||
| crontab -l | grep -v "$SCRIPT_NAME" > /tmp/current_crontab | 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 "00 2 * * * $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 "05 2 * * * $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 "10 2 * * * $SCRIPT_PATH \$(date -I -d 'today') >> $LOG_FILE 2>&1" >> /tmp/current_crontab | ||||||
| crontab /tmp/current_crontab | crontab /tmp/current_crontab | ||||||
| rm /tmp/current_crontab | rm /tmp/current_crontab | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user