Skip to content

Instantly share code, notes, and snippets.

@jbearden0
Created March 29, 2016 21:07
Show Gist options
  • Save jbearden0/d6959bd5e9bf6a8ec1603c39826d9e2f to your computer and use it in GitHub Desktop.
Save jbearden0/d6959bd5e9bf6a8ec1603c39826d9e2f to your computer and use it in GitHub Desktop.
#!/bin/bash
user=secret
pass=secret
dbfile='/var/lib/firebird/2.5/rsgdata.gdb'
dbname=$(mktemp -u)
echo $dbname
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 "Stopping firebird..."
service firebird2.5-super stop
echo "Copying database..."
cp $dbfile /tmp
echo "Removing database..."
rm -f $dbfile
echo "Starting firebird..."
service firebird2.5-super start
echo "Restoring database..."
gbak -c ${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