Skip to content

Instantly share code, notes, and snippets.

@jedgalbraith
Last active December 17, 2015 12:58
Show Gist options
  • Save jedgalbraith/5613280 to your computer and use it in GitHub Desktop.
Save jedgalbraith/5613280 to your computer and use it in GitHub Desktop.
pagoda cron commands for regular MySQL backups
# 'backups/' dir must exist previously.
# Removes backup files older than 7 days,
Command: find backups/* -mtime +7 -exec rm {} \;
# Every day at midnight
UNIX cron schedule: 0 0 * * *
# Creates backups in the 'backups/' writable directory.
Command: mysqldump -h $DB1_HOST -P $DB1_PORT -u $DB1_USER -p$DB1_PASS $DB1_NAME > backups/$DB1_NAME-"$(date +"%m_%d_%Y")".sql
# Every day at 1AM
UNIX cron schedule: 0 1 * * *
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment