[ale] bash script with su

Jerald Sheets questy at gmail.com
Mon Jun 8 10:54:36 EDT 2009


Is it possible the arg/command itself is in the wrong place?

su [OPTION] ... [-] [USER [ARG]...]

Would flipping the order have any effect?

su -l postgres -c "initdb && pg_ctl start && createlang plpgsql template1 &&
createdb batadm && createuser -s batadm " >>$log 2>&1



(keep in mind I'm learning here a bit too.  I've had weirdness with commands
preferring a particular order when the docs were not clear the order was
important (or required)

Also, the question I have about the create commands (I don't use
postgres...  sorry for the newbieness).  Are createdb and createuser
postgres commands on the fs somewhere?

I also notice that the -l option's normal operation (according to the info
pages) will "Unset all environment variables except 'TERM', 'HOME',
'SHELL', 'USER' and 'LOGNAME', and set 'PATH' to a compiled-in default
value.  Change to the USER's home directory and prepend '-' to the shell's
name, intended to make it read its login startup file(s)"

Are these perhaps thwarting you as well?


Hope it has bearing, and thanks in advance for the answers...


--j

On Mon, Jun 8, 2009 at 10:18 AM, Jim Kinney <jim.kinney at gmail.com> wrote:

>
>
> su -l -c "initdb && pg_ctl start && createlang plpgsql template1 &&
> createdb batadm && createuser -s batadm " postgres >>$log 2>&1
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.ale.org/pipermail/ale/attachments/20090608/fe4181b7/attachment-0001.html 


More information about the Ale mailing list