Created
March 29, 2016 21:07
-
-
Save jbearden0/d6959bd5e9bf6a8ec1603c39826d9e2f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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