[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[3215] trunk/tools/delete-company-database.sh
- Subject: SF.net SVN: ledger-smb:[3215] trunk/tools/delete-company-database.sh
- From: ..hidden..
- Date: Sat, 11 Jun 2011 13:48:02 +0000
Revision: 3215
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3215&view=rev
Author: ehuelsmann
Date: 2011-06-11 13:48:02 +0000 (Sat, 11 Jun 2011)
Log Message:
-----------
Add a script for to clean up the default company database.
Note: Added mainly because I keep typing these commands during testing.
Added Paths:
-----------
trunk/tools/delete-company-database.sh
Added: trunk/tools/delete-company-database.sh
===================================================================
--- trunk/tools/delete-company-database.sh (rev 0)
+++ trunk/tools/delete-company-database.sh 2011-06-11 13:48:02 UTC (rev 3215)
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+cmd="select rolname FROM pg_roles WHERE rolname LIKE 'lsmb_${1}__%';"
+company_roles=`su -c "psql -U postgres -t -c \"$cmd\"" postgres`
+
+su -c "dropdb -U postgres $1" postgres
+
+for role in $company_roles
+do
+ su -c "dropuser -U postgres \"$role\"" postgres
+done
+
+if test -n "$2"
+then
+ su -c "dropuser -U postgres \"$2\"" postgres
+fi
Property changes on: trunk/tools/delete-company-database.sh
___________________________________________________________________
Added: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.