Compare commits
No commits in common. "62618d099a187f44814c4b8b3ce5a65033bdac7d" and "0986e3bebbd8feaa320e9d3643ada4d7f92c142a" have entirely different histories.
62618d099a
...
0986e3bebb
@ -13,7 +13,7 @@
|
||||
set -e
|
||||
|
||||
# Define variables
|
||||
DATE=${1:-$(date -I)}
|
||||
DATE=$(date -I)
|
||||
DEST_DIR="/usr/local/share/GeoIP"
|
||||
FN="GeoLite2-City-${DATE//-/}.tar.gz"
|
||||
URL="https://github.com/merkez/maxmind-databases/releases/download/${DATE}/${FN}"
|
||||
|
15
setup.sh
15
setup.sh
@ -29,16 +29,15 @@ sudo chmod 775 "$DEST_DIR"
|
||||
sudo cp "$SCRIPT_NAME" "$SCRIPT_PATH"
|
||||
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
|
||||
crontab /tmp/current_crontab
|
||||
# Step 5: Add a crontab entry (if it doesn't already exist)
|
||||
# Create temporary crontab file
|
||||
crontab -l > /tmp/current_crontab
|
||||
if ! grep -Fq "$SCRIPT_NAME" /tmp/current_crontab; then
|
||||
echo "$CRON_SCHEDULE $CRON_CMD" >> /tmp/current_crontab
|
||||
crontab /tmp/current_crontab
|
||||
fi
|
||||
rm /tmp/current_crontab
|
||||
|
||||
|
||||
# Step 6: Ensure log file exists and is writable
|
||||
sudo touch "$LOG_FILE"
|
||||
sudo chown :"$GROUP_NAME" "$LOG_FILE"
|
||||
|
Loading…
Reference in New Issue
Block a user