Did You Know: Off-Site Backups
Did you know that you can use crontab
to push your backups off-site? You'd need to first decide how. SFTP? Dropbox? Pigeons?
We here at Eldritch Industries are using Google Drive. (Because I was asked.) Thanks to @Glitch, here's the code we're using:
#!/bin/bash
#
# takes the last two touched files and uses the google drive cli
#
# the last two touched files will be the flatfile (*.tar.gz) and
# the sql file (*.sql.gz)
#
# this is pretty specific to eldritchmux
#
BACKUPS="/home/mu/eldritch/game/backups"
BINLOC="__REDACTED__"
GDRIVEFOLDER="__REDACTED__"
#
for DUMP in $(ls -Atr $BACKUPS/*.gz | tail -2)
do
$BINLOC/drive-linux-amd64 upload -f $DUMP -p $GDRIVEFOLDER
done
Does it work? Boy howdy does it work. We have it running 10 minutes after the other two backups: One for Flatfile, one for SQL. (Are you using SQL and not backing it up? Why?) That is, the | tail -2
means it will back up the two most recently touched (usually created) files in the directory. Adjust this number for the number of files that count as "recent".
Likewise thanks to @Chime for her earlier work on Mu* server maintenance, for the SQL dump script this is also using.