Stopping process in /etc/inittab kills spawned process. Doesn't happen in rc.local.

Posted by Paul on Stack Overflow See other posts from Stack Overflow or by Paul
Published on 2010-06-04T18:11:36Z Indexed on 2010/06/05 6:42 UTC
Read the original article Hit count: 189

Filed under:

Hi,

I'm trying to execute a firmware upgrade while my programming is running in inittab. My program will run 2 commands. One to extract the installer script from the tarball and the other to execute the installer script. In my code I'm using the system() function call. These are the 2 command strings below,

   system ( "tar zvxf tarball.tar.gz -C / installer.sh 2>&1" );

   system( "nohup installer.sh tarball >/dev/null 2>&1 &" );

The installer script requires the tarball to be an argument. I've tried using sudo but i still have the same problem. I've tried nohup with no success. The installer script has to kill my program when doing the firmware upgrade but the installer script will stay alive.

If my program is run from the command line or rc.local, on my target device, my upgrade works fine, i.e. when my program is killed my installer script continues.

But I need to run my program from /etc/inittab so it can respawn if it dies. To stop my program in inittab the installer script will hash it out and execute "telinit q". This is where my program dies (but thats what I want it to do), but it also kills my installer script.

Does anyone know why this is happening and what can I do to solve it?

Thanks in advance.

© Stack Overflow or respective owner

Related posts about linux