Daily backups run on kingfoods.org at 3:00 am. This is established by a cron job that runs a local bash script which:
- removes all files in the backups/ directory that are older than 30 days
- mysqldumps the primary database into a stamped file in the backup dir
A local rsync bash file runs every hour on the 5th minute which:
- removes all files in the rsync_backups/ directory older than 30 days
- rsyncs the remote backup folder to the local backup folder
#!/bin/bash
DAY=30
DIR="/var/www/SITE_HERE/rsync_backups/"
RDIR="sshuser@remote:~/backups/"
# Remove old files
echo "find ${DIR} -mtime +${DAY} -exec rm {} \\;"
find ${DIR} -mtime +${DAY} -exec rm {} \;
# Rsync new backups
echo "rsync -az ${RDIR} ${DIR}"
rsync -az ${RDIR} ${DIR}