0

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.

0

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

| 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.