Author Topic: rc.d  (Read 741 times)

Master of Reality

  • VIP
  • Member
  • ***
  • Posts: 4,249
  • Kudos: 177
    • http://www.bobhub.tk
rc.d
« on: 23 July 2002, 05:26 »
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 ]

Disorder | Rating
Paranoid: Moderate
Schizoid: Moderate
Linux User #283518
'It takes more than a self-inflicted gunshot wound to the head to stop Bob'

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
rc.d
« Reply #1 on: 23 July 2002, 07:00 »
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.
Someone please remove this account. Thanks...

Master of Reality

  • VIP
  • Member
  • ***
  • Posts: 4,249
  • Kudos: 177
    • http://www.bobhub.tk
rc.d
« Reply #2 on: 23 July 2002, 07:27 »
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 ?
Disorder | Rating
Paranoid: Moderate
Schizoid: Moderate
Linux User #283518
'It takes more than a self-inflicted gunshot wound to the head to stop Bob'

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
rc.d
« Reply #3 on: 23 July 2002, 08:16 »
I would do it like this:

su - mor -c "/command/setiathome > /tmp/setiathome.log 2>&1 &"
Someone please remove this account. Thanks...

Master of Reality

  • VIP
  • Member
  • ***
  • Posts: 4,249
  • Kudos: 177
    • http://www.bobhub.tk
rc.d
« Reply #4 on: 23 July 2002, 21:31 »
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 ]

Disorder | Rating
Paranoid: Moderate
Schizoid: Moderate
Linux User #283518
'It takes more than a self-inflicted gunshot wound to the head to stop Bob'

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
rc.d
« Reply #5 on: 23 July 2002, 21:36 »
Why not just run it the way the instructions suggest to run it?

http://setiathome.ssl.berkeley.edu/unix.html

or from cron as the README states:

http://setiathome.ssl.berkeley.edu/README.unix.txt

[ July 23, 2002: Message edited by: VoidMain ]

Someone please remove this account. Thanks...