[Fusionforge-commits] r13722 - trunk/tests/func

Christian Bayle cbayle at fusionforge.org
Fri Jul 8 12:31:22 CEST 2011


Author: cbayle
Date: 2011-07-08 12:31:22 +0200 (Fri, 08 Jul 2011)
New Revision: 13722

Modified:
   trunk/tests/func/db_reload.sh
Log:
Some cleanup 


Modified: trunk/tests/func/db_reload.sh
===================================================================
--- trunk/tests/func/db_reload.sh	2011-07-08 10:30:19 UTC (rev 13721)
+++ trunk/tests/func/db_reload.sh	2011-07-08 10:31:22 UTC (rev 13722)
@@ -14,25 +14,36 @@
 	echo "Forge database is $database"
 fi
 
-echo "Cleaning up the database"
+echo "Stopping apache"
 if type invoke-rc.d 2>/dev/null
 then
 	invoke-rc.d apache2 stop
+else
+	service httpd stop
+fi
+
+echo "Starting the database"
+if type invoke-rc.d 2>/dev/null
+then
 	invoke-rc.d postgresql restart
 else
-	service httpd stop
 	service postgresql restart
 fi
 
+echo "Droping database $database"
 su - postgres -c "dropdb -e $database"
-#echo "Executing: pg_restore -C -d template1 < /root/dump"
-#su - postgres -c "pg_restore -C -d template1" < /root/dump
-#echo "Executing: psql < /root/dump"
-#su - postgres -c "psql" < /root/dump
 
-echo "Executing: psql -f- < /root/dump"
-su - postgres -c "psql -f-" < /root/dump > /var/log/pg_restore.log 2>/var/log/pg_restore.err
+if [ -f /root/dump ]
+then
+	echo "Restore database from dump file: psql -f- < /root/dump"
+	su - postgres -c "psql -f-" < /root/dump > /var/log/pg_restore.log 2>/var/log/pg_restore.err
+else
+	# TODO: reinit the db from scratch and create the dump
+	echo "Couldn't restore the database: No /root/dump found"
+	exit 2
+fi
 
+echo "Starting apache"
 if type invoke-rc.d 2>/dev/null
 then
 	invoke-rc.d apache2 start




More information about the Fusionforge-commits mailing list