Me personally I cannot use the delete-company-database.sh as supplied because my postgres user account is set up as not able to login.

What I have to do is use sudo prefixed in each of the four places su is used (see attached svn diff), since I have sudo su privileges configured for my personal, non-root user account.

Would this be considered an advisable approach more generally enough to warrant applying that patch to trunk?

Index: tools/delete-company-database.sh
===================================================================
--- tools/delete-company-database.sh    (revision 5130)
+++ tools/delete-company-database.sh    (working copy)
@@ -11,16 +11,16 @@
 fi
 
 cmd="select rolname FROM pg_roles WHERE rolname LIKE 'lsmb_${1}__%';"
-company_roles=`su -c "psql -U postgres -t -c \"$cmd\"" postgres`
+company_roles=`sudo su -c "psql -U postgres -t -c \"$cmd\"" postgres`
 
-su -c "dropdb -U postgres $1" postgres
+sudo su -c "dropdb -U postgres $1" postgres
 
 for role in $company_roles
 do
-  su -c "dropuser -U postgres \"$role\"" postgres
+  sudo su -c "dropuser -U postgres \"$role\"" postgres
 done
 
 if test -n "$2"
 then
-  su -c "dropuser -U postgres \"$2\"" postgres
+  sudo su -c "dropuser -U postgres \"$2\"" postgres
 fi
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Ledger-smb-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel

Reply via email to