Backup of Chyrp

With NB, off-line backup was rather easy - essentially I was dealing with textual content from two sources that could be easily synchronized with basic shell tools.

Chyrp, on the other hand, required that I duplicate both the MySQL database and the static content, and that I had a web browser handy to access the graphical markup tools provided.

I had to dump the contents of the remote MySQL database to a local file, which could then be used to recreate the on-line database if ever the need arose. I created the following script for that purpose:

1
2
3
4
5
6
7
8

#!/bin/sh
MYSQLBACKUP=/home/$USER/.mysql_backup
DB_NAME=dump.sql
[ -f $MYSQLBACKUP/$DB_NAME.1 ] && mv -f $MYSQLBACKUP/$DB_NAME.1 $MYSQLBACKUP/$DB_NAME.2
[ -f $MYSQLBACKUP/$DB_NAME.0 ] && mv -f $MYSQLBACKUP/$DB_NAME.0 $MYSQLBACKUP/$DB_NAME.1
[ -f $MYSQLBACKUP/$DB_NAME ] && mv -f $MYSQLBACKUP/$DB_NAME $MYSQLBACKUP/$DB_NAME.0
ssh USER@host mysqldump -h MYSQL.HOST -u USER -pPASSWORD DBNAME > $MYSQLBACKUP/$DB_NAME

With a rudimentary backup method in place, I could now completely migrate away from NanoBlogger.