Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know how to fork to process. That is not a problem. But my issue is a little different. Example inittab line:

::respawn:-/usr/bin/python /path/to/script.py && /bin/sh -l -c 'chown user1:user1 /tmp/file'

As far as I know this works for normal situations. But this python script is a long-run process. As it doesn't end, the second part of line is not executed. At least that's what I thought. '/tmp/file' is created by this python script. That's why I am trying to use one line. As soon as python script restarted, I should change ownership of the mentioned file. I can hear you saying 'change the script'. So true. It is not that hard. But I am eager to know how to do that with inittab or something else?

Edit: Is there a way to run this python script with another user than root within inittab?

I am using a busybox installation.

share|improve this question

::respawn:-/usr/bin/python /path/to/script.py & /bin/sh -l -c 'chown user1:user1 /tmp/file'

share|improve this answer
    
In this case it keeps forking processes. Because of 'respawn'. But I also need that. I need python script running all the time but changing ownership should run only once and then die. And now I guess it is not possible with only inittab. As everytime 'chown' dies it forks python script again and again. Is there a way to run this python script with another user than root within inittab? – savruk Oct 19 '11 at 9:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .