Skip to content

Instantly share code, notes, and snippets.

@gmambro
Created March 3, 2016 09:43
Show Gist options
  • Save gmambro/80b26b9f7e8d2b73bca3 to your computer and use it in GitHub Desktop.
Save gmambro/80b26b9f7e8d2b73bca3 to your computer and use it in GitHub Desktop.
Simple script for running trac hotcopy
#!/bin/sh
TRAC_ADMIN=$(which trac-admin)
TRAC_LIB=/var/lib/trac
TRAC_BACKUP_DIR=/var/lib/backup/trac
if [ $# != 1 ]; then
echo "usage $0 <env>"
exit 1
fi
env=$1
env_dir=$TRAC_LIB/$env
if [ ! -d "$env_dir" ]; then
echo "Cannot find $env_dir"
exit
fi
if [ ! -d "$TRAC_BACKUP_DIR" ]; then
echo $TRAC_BACKUP_DIR does not exist
exit 1
fi
backup_dir=$TRAC_BACKUP_DIR/$env
if [ -d $backup_dir ]; then
echo "removing old backup"
rm -rf "$backup_dir"
fi
$TRAC_ADMIN "$env_dir" hotcopy "$backup_dir"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment