Author: justi9
Date: 2008-01-17 16:22:56 -0500 (Thu, 17 Jan 2008)
New Revision: 1568
Added:
mgmt/mint/bin/mint-database-init
Log:
Adds a script to create a postgresql user and database and then load
its schema. This version doesn't do any nice defaulting. We should
add that.
Added: mgmt/mint/bin/mint-database-init
===================================================================
--- mgmt/mint/bin/mint-database-init (rev 0)
+++ mgmt/mint/bin/mint-database-init 2008-01-17 21:22:56 UTC (rev 1568)
@@ -0,0 +1,16 @@
+#!/bin/bash -v
+
+# This script assumes that postgresql is configured and running
+
+if [ "$#" -lt 3 ]; then
+ echo "Usage: mint-database-init USER-NAME DATABASE-NAME SCHEMA-FILE"
+ exit 2
+fi
+
+user="$1"
+db="$2"
+schema="$3"
+
+su postgres -c "createuser --superuser ${user}"
+su postgres -c "createdb --owner=${user} ${db}"
+su "$user" -c "psql -d ${db} -f ${schema}"
Property changes on: mgmt/mint/bin/mint-database-init
___________________________________________________________________
Name: svn:executable
+ *
Show replies by date