Created
February 7, 2019 07:57
-
-
Save yglodt/b314b6cb37d6c55447a9bf6052c94066 to your computer and use it in GitHub Desktop.
This file contains 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 | |
if [[ "$1" == "" ]]; then | |
echo "Dump file to restore not specified, please give it as parameter." | |
exit 1 | |
fi | |
echo "Stopping apache2" | |
sudo service apache2 stop | |
#echo "Stopping tomcat7" | |
#sudo service tomcat7 stop | |
echo "Restarting postgresql" | |
sudo service postgresql restart | |
echo "Dropping mydb database" | |
sudo -u postgres dropdb mydb | |
echo "Creating new mydb database" | |
sudo -u postgres createdb mydb | |
echo "Restoring backup dump" | |
#sudo -u postgres pg_restore --create --clean -v -d mydb $1 | |
sudo -u postgres pg_restore -v -d mydb $1 | |
#echo "Starting tomcat7" | |
#sudo service tomcat7 start | |
echo "Starting apache2" | |
sudo service apache2 start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment