On 6/2/2011 3:36 PM, Alexander Farber wrote:
I'll omit fork() and run my script from /etc/inittab as
pref:3:respawn:/bin/su -c '/usr/local/pref/pref.pl' nobody 2>&1> /tmp/pref.txt
Do you think I still need setsid(); chdir("/"); and umask(0); ?
Not sure about the setsid() - I think you want to stay in the same process group so init catches the sigchld and knows to respawn. Then again, init inherits orphan children to clean up their exit status anyway so maybe it doesn't matter. The rest affect the program behavior and should stay the same.