Description

This set of scripts automatically back up the MOO's checkpoint dbs whenever the server completes a checkpoint. They're not very polished or generalized, but they work for Waterpoint.

The first script, watchlog, forks a background task to use tail to feed lines from the log into the second script (watchlog.py).

The second script, watchlog.py, reads lines from the log from stdin and looks for the "checkpoint completed" message. Whenever it sees that line, it runs the third script.

The third script, backup, handles copying the freshly completed checkpoint db into another directory with a timestamped name.

Download

dbbackup.tar.gz contains all of the scripts as they're used by Waterpoint. You'll want to customize them before trying to use them.

Installation Notes

You'll need to customize the scripts with the appropriate paths. watchlog needs to have the path to the log file, watchlog.py needs the path to the backup script and the database name in the CHECKPOINTING expression set, and the backup script needs the paths for both the checkpoint db and the directory to put the backups in.

Operation

Once the paths are set, you should run the watchlog script. There's no message saying it's running and it's not smart enough to make sure only one is running.

Note that nothing in these scripts ever deletes backups. When everything is installed, every checkpoint your MOO makes will be copied into the backup directory as MOOname-yyyymmdd-hhmm.db.gz. Eventually these will take up a lot of space. You might want to prune the old copies occasionally.

These scripts have only been tested on Linux (Debian). Particularly the watchlog script may need to be tweaked on other OSes. You'll need python installed to use watchlog.py. None of these scripts are very complicated, though, so even if these do not work at all for you the idea should be easy to replicate.