Miscellaneous scripts

In the time I've been writing software and managing Linux servers, I've of course ended up with quite a collection of quick and dirty, but often very useful scripts that I have written that do not exactly constitute a project in their own right. All of these scripts can be found in the Subversion repository. Some of the more useful ones are highlighted below.

autolatex.sh - A simple script to watch a load of LaTeX files, processing them and redisplaying the output when any of the files change. Very simple, but a good example of a use for inotifywait.

svnrollback - A very quick script I wrote to rollback a particular file in a svn working copy to a previous revision. Currently has next to no validation, planning to write it properly in python so I can use the XML output of svn info.

apache2-gencert.sh - Generates a self-signed SSL certificate for a given domain name, puts it in /etc/apache2/ssl/ and displays the 2 lines needed for the Apache2 config file to use it.

backup-run.sh - Simple backup script which can be put in a cron job. Edit DIRS variable to set the directories you want to backup (look at the examples for syntax) and BACKUP_HOST for scp backups. To do non-interactive scp backups you will need to make an SSH key with no passphrase and add it to the allowed keys of your backup user on the remote server. Not hugely efficient, you will need enough space on your /tmp to store the compressed copies of the target dirs temporarily.

backup-clean.pl - Probably the only useful bit of perl I have ever written... Used for keeping on the last 'n' backups of each type, based on filenames like those generated by backup-run.sh - i.e. hostname-somedir-2007-01-07-0801.tar.bz2. Can be used in a cron-job, useful to run after/before something like backup-run.sh. Usage is backup-clean.pl DIR [ COUNT ] where DIR is the path to the directory containing the backups and COUNT is an optional parameter specifying the number of backups to keep (1 by default).

Last modified September 16th, 2008 at 2:18 p.m.