· Pretty Good Hat · archive · about·

Tuning up my Backups

 

Some instability with my web host the past week or so prompted me to think about the state of the backups of my online spaces. I spent some time today getting backup scripts working on the host, and found that, based on the file dates, the last time I worked on this was about a year ago. Yay, me. After troubleshooting them for a little while I now have some functional backup scripts to tar up my web directories and my databases. Then I set about burning most of the morning getting my Synology to grab the backup from the host.1

Because I’ll forget and no doubt have to do this again, I took a few notes:

With passwordless login to the Synology, and from the Synology to my host and backup server working, finally, I could test executing my backup scripts from the shell on the Synology. Lo and behold, it works! In the “Scheduled Tasks” section of the Synology control panel, I set up these scripts to execute the remote backup and periodically download the resulting files:

Runs twice weekly:

/usr/bin/ssh kaizen 'cd ~/backup-scripts; ./backup-mysql-databases; ./backup-files'

Runs weekly:

/usr/syno/bin/rsync -av --progress strongspace:arlington-backup/ /volume1/Archive/backup/kaizengarden

Why not run these daily? Because these sites don’t actually change all that much. Downloading the full backup weekly is plenty, if not outright overkill, since the most frequently-changed part of the site is all markdown files stored in dropbox and synced when I re-publish. Why not schedule the backup to run via cron on my host? Because this works, and I was already in the Synology shell experimenting, so it was easy to not have to log in to the web server. (And last time I worked on the backup scripts at the host, I remember some kind of problem with running them via cron; some kind path or environment thing interacting with tar, I think. So this got around that, too.)

I did the same for my stuff over at tilde.club, too. This didn’t require any backup script, since I just have a single directory there; I just rsync the whole relatively small thing into a backup folder on the synology here.


  1. It’s not actually directly from the host. My scripts pack up the tar archives and rsync them to my backup location at Strongspace. [return]