Tying up loose Ends
From the Show-and-Tell-Department
While I've got plenty of "big stuff" to do, such as finally finishing the Datenschleuder, get over with my bookkeeping so I can file my income taxes or finish the finaly version of a website design which is due Tuesday, I just don't seem to get some consecutive quality time in, these days.
Clients with emergencies (luckily just little ones, nothing of Cryx's encounter today or this) or simply plain old family matters or the correlation of the lack of contents of our fridge to the opening hours of our local supermarket.
So what to do, if all you get are little bits of time? Well, I've picked up the habit of doing little things that are important but otherwise too little to stand a chance against the 'big things'.
As an example, I've just brushed up my backup-script for this host. It's running on my home server and makes daily backups of all configuration files of this server. So, just in case you, too would like to keep your tediously laboured config files safe (i.e. offsite!) you can use the following shell-script snippet as a starting point:
#!/bin/sh BACKUP_HOME="/home/tomster/backups" BACKUP_DIRNAME="tomster.org-backup" BACKUP_DIR=$BACKUP_HOME"/"$BACKUP_DIRNAME ARCHIVE_DIRNAME="tomster.org-archive" RSYNC_BIN="/usr/local/bin/rsync" echo 'syncing /usr/local/etc'; $RSYNC_BIN -vrpoge ssh tomster@tomster.org:/usr/local/etc/ \ $BACKUP_DIR/usr/local/etc echo 'syncing /etc'; $RSYNC_BIN -vrpoge ssh tomster@tomster.org:/etc/ \ $BACKUP_DIR/etc echo 'syncing mailman lists'; $RSYNC_BIN -vrpoge ssh tomster@tomster.org:/usr/local/mailman/lists/ \ $BACKUP_DIR/usr/local/mailman/lists ARCHIVE_FILE=$BACKUP_HOME"/"$ARCHIVE_DIRNAME"/"\ `date "+%Y-%m-%d"`".tgz"; echo 'creating archive '$ARCHIVE_FILE; tar czf $ARCHIVE_FILE -C $BACKUP_HOME $BACKUP_DIRNAME
It keeps a synchronized tree of /etc, /usr/local/etc and /usr/local/mailman/lists in a designated target directory and creates a .tgz archive of each sync that it makes in another one, labelling it with the date of the snapshot. Very simply, but very useful.
In order for this to work, the user executing this script must have a key-based log-in on the target host using a key without a passphrase. To make the script run automatically on a regular basis, save the script in ~/bin/backup.sh and install the following crontab using crontab -e
MAILTO=your@email.adr @daily ~/bin/backup.sh
