Operating Systems > Linux and UNIX
rc.d
Master of Reality:
when i run things at startup (in rc.local) does it run as root?
How do i get it to run as a certain user?
[ July 22, 2002: Message edited by: Master of Reality / Bob ]
[ July 22, 2002: Message edited by: Master of Reality / Bob ]
voidmain:
Yes it does run as root. You can use the "su" command to run something as another user among other methods:
su - someuser -c "/bin/command args"
And if the command is intended to be run continuously do not forget to redirect the output and background it with the "&" so your startup script does not hang.
Master of Reality:
how do i redirect its output? If i want to run seti as user mor i just put:
su - mor -c /command/setiathome &
it only gives the little output when you first start it ssys "setiathome has started, this is the last message you will recieve", do i still need to redirect that to /dev/null ?
voidmain:
I would do it like this:
su - mor -c "/command/setiathome > /tmp/setiathome.log 2>&1 &"
Master of Reality:
can i do this to make it run continously and wait 30 minutes between each time it shuts down and when it restarts (in case the seti servers go down i dont want to keep requesting).
while true
do
su - mor -c "all that stuff"
sleep 1800
done
[ July 23, 2002: Message edited by: Master of Reality / Bob ]
[ July 23, 2002: Message edited by: Master of Reality / Bob ]
Navigation
[0] Message Index
[#] Next page
Go to full version