On Sat, Jun 24, 2000 at 01:41:26PM +0200, Jasper Spit wrote:
-> Hi,
-> 
-> On Mandrake 7.0 when you do a su - <user> -c "command" from the root
-> account,
-> <user>'s profile is not loaded. When you just do a su - <user>, it works OK.
-> 
-> This is very annoying, I need to create a script that runs as root and
-> executes some
-> commands as another user. I can't get this to work right now.
-> Even su - <user> -c ". .profile; echo $ORACLE_HOME" doesn't work.
-> 
-> How can I get this fixed ? I can't remember having this problem on Red Hat
-> or SuSE.
-> I upgraded to the newest sh-utils, but that didn't help either.
-> 
-> Also, su doesn't return the correct errorcode if you use the -c flag, it
-> always returns 0.
-> This works fine on e.g. HP/UX and Sun Solaris.

I suspect you want to take out the initial hyphen. Here is what I use to
start up the distributed net daemon:


# dnetc 2000 06 21 16:19:34
pushd /home/dnetc/bin
su dnetc -c \"./dnetc\" -s /bin/bash
popd

Your initial hyphen tells su to run the login sequence, e.g. run the
.bash_profile, etc.


-- 

                -- C^2

No windows were crashed in the making of this email.

Looking for fine software and/or web pages?
http://w3.trib.com/~ccurley

PGP signature

Reply via email to