I have an embedded system, on which I do telnet
and then I run an application in background:
./app_name &
Now if I close my te
In order completely understand whats happening you need to get into unix
internals a little bit.
When you are running a command like this
./app_name &
The app_name
is sent to background process group. You can check about unix
process groups here
When you close bash
with normal exit it triggers SIGHUP
hangup signal to all its jobs. Some information on unix
job control is here.
In order to keep your app running when you exit bash
you need to make your app immune to hangup signal with nohup
utility.
nohup - run a command immune to hangups, with output to a non-tty
And finally this is how you need to do it.
nohup app_name & 2> /dev/null;