Skip to content

Instantly share code, notes, and snippets.

@jbearden0
Last active March 30, 2016 13:04
Show Gist options
  • Save jbearden0/ae1674cda82fc55651e662e99aa28ba2 to your computer and use it in GitHub Desktop.
Save jbearden0/ae1674cda82fc55651e662e99aa28ba2 to your computer and use it in GitHub Desktop.
#!/bin/bash
user=secret
pass=secret
dbfile='/var/lib/firebird/2.5/data/rsgdata.gdb'
dbname=$(mktemp -u)
echo $dbname
echo "Stopping firebird..."
service firebird2.5-super stop
echo "Copying database..."
cp -f $dbfile /tmp/${dbname}.orig.gdb
echo "Starting firebird..."
service firebird2.5-super start
echo "Locking database..."
gfix -user $user -password $pass localhost:rsgdata -shut single -force 5
echo "Backing up database..."
gbak -b localhost:rsgdata ${dbname}.bak.orig.gdb -user $user -pas $pass
echo "Restoring database..."
gbak -rep ${dbname}.bak.orig.gdb localhost:rsgdata -user $user -pas $pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment