[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[4117] branches/1.3/tools/delete-mycompany-roles.sh



Revision: 4117
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4117&view=rev
Author:   tshvr
Date:     2011-12-01 11:10:28 +0000 (Thu, 01 Dec 2011)
Log Message:
-----------
script to delete lsmb_ roles,may be useful in testing

Added Paths:
-----------
    branches/1.3/tools/delete-mycompany-roles.sh

Added: branches/1.3/tools/delete-mycompany-roles.sh
===================================================================
--- branches/1.3/tools/delete-mycompany-roles.sh	                        (rev 0)
+++ branches/1.3/tools/delete-mycompany-roles.sh	2011-12-01 11:10:28 UTC (rev 4117)
@@ -0,0 +1,22 @@
+#!/bin/sh
+RC=0;
+MY_COMPANY=$1;
+[ -n "$MY_COMPANY" ] || { echo "parm 1 MY_COMPANY missing!";exit 1;}
+LIKE_ARG="'lsmb_$MY_COMPANY%'";
+CMD="select '\"'||rolname||'\"'||'@' FROM pg_roles WHERE rolname LIKE $LIKE_ARG;";
+echo "MY_COMPANY=$MY_COMPANY LIKE_ARG=$LIKE_ARG CMD=$CMD";
+company_roles=`sudo -u postgres psql -q -t -c "$CMD"`;
+#echo "company_roles=$company_roles";
+OLDIFS=$IFS
+IFS=@
+for role in $company_roles
+do
+  #echo "role=$role"
+  role1=$(echo $role|tr '\n' ' ')
+  #echo "role1=$role1"
+  cmd_drop="drop user $role1;"
+  #echo "cmd_drop=$cmd_drop"
+  #echo $cmd | psql template1
+  RC=`sudo -u postgres psql -q -t -c "$cmd_drop"`
+  echo "cmd_drop=$cmd_drop RC=$RC \$?=$?";
+done


Property changes on: branches/1.3/tools/delete-mycompany-roles.sh
___________________________________________________________________
Added: svn:executable
   + *

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.