Skip to content

Commit

Permalink
More echoes (#12)
Browse files Browse the repository at this point in the history
- `echo` when a script _(`backup`, `delete`)_ is added to cron jobs.
  • Loading branch information
jmqm authored Jul 14, 2021
1 parent fcda17f commit 11c8653
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion delete.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ cd /backups
find . -iname "*.tar.xz" -type f -mtime +$DELETE_AFTER -exec rm -f {} \;

# Echo that script ran.
echo "Deleted files older than $DELETE_AFTER days."
echo "[INFO] Deleted files older than $DELETE_AFTER days."
6 changes: 4 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ fi

# Create cron jobs.
if [ "$(id -u)" -eq 0 ] && [ "$(grep -c "$BACKUP_CMD" "$CRONFILE")" -eq 0 ]; then
# Add backup script to cron job list.
# Add backup script to cron jobs.
echo "$CRON_TIME $BACKUP_CMD >> $LOGS_FILE 2>&1" | crontab -
echo "[INFO] Added delete script to cron jobs."

# Check if $DELETE_AFTER is not null and is greater than 0.
# If so, add it to the cron job list.
# If so, add it to cron jobs.
if [ -n "$DELETE_AFTER" ] && [[ "$DELETE_AFTER" -gt 0 ]]; then
echo "$CRON_TIME $DELETE_CMD >> $LOGS_FILE 2>&1" | crontab -
echo "[INFO] Added delete script to cron jobs."
fi
fi

Expand Down

0 comments on commit 11c8653

Please sign in to comment.