[ale] bash script with su

Jim Kinney jim.kinney at gmail.com
Mon Jun 8 11:10:04 EDT 2009


On Mon, Jun 8, 2009 at 10:25 AM, Mills John M-NPHW64<Jmills at motorola.com> wrote:
> If you control the script, why do you need different parts of it to run at
> different privilege levels? Instead access-protect it, limit who can launch
> it, and have them launch it '$ sudo <my_script>' if necessary. (I do this,
> so I would be happy to know if it's not smart!!)

It's on a CD for unattended, automatic installation. All users listed
are either system or dummy accounts.
>
>  - JMM
>
>
> -----Original Message-----
> From: ale-bounces at ale.org on behalf of Jim Kinney
> Sent: Mon 6/8/2009 10:18 AM
> To: Atlanta Linux Enthusiasts - Yes! We run Linux!
> Subject: [ale] bash script with su
>
> I have bash script that does a gazillion things. EXCEPT two of the
> "su" lines don't do anything.
>
> user batadm and postgres are created (correctly - they works) followed by:
>
> echo 'export PGHOME=/usr/local/postgresql
> export PGDATA=/data/pgdata
> export PATH=$PGHOME/bin:$PATH
> ' >> /home/postgres/.bashrc
>
> which should set the path to the custom postgresql binaries
>
> now run
>
> su -l -c "initdb && pg_ctl start && createlang plpgsql template1 &&
> createdb batadm && createuser -s batadm " postgres >>$log 2>&1
>
> where $log is a file defined earlier for install data capture. At this
> point it shows an execute of initdb and then nothing.
>
> Does the -c "stuff" just refuse to run sequential comands? I did the
> manual su -l batadm and ran the same command sequence successfully
> after totally deleting all the initdb files structure in postgresql.
> So the stuff inside the quotes works. $PATH _should_ be updated for
> the postgres user by the su -l  .
>
> The same type of "nothing happens" error occurs later when the batadm
> user is called to do a series of new sql script inits for the new
> batadm database. Run manually, the process is fine. Run in a su -l
> sequence of &&'ed calls it fails and generates no error message.
>
> Ideas?
>
> --
> --
> James P. Kinney III
> Actively in pursuit of Life, Liberty and Happiness
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
>
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
>
>



-- 
-- 
James P. Kinney III
Actively in pursuit of Life, Liberty and Happiness



More information about the Ale mailing list