Say if I run some command in background:
./my_script.sh > /dev/null &
and I close putty immediately (which is equivalent to disconnect current session right?).
Will the background process finish? Please advise, thanks.
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.
Sign up to join this communityWhen you exit an interactive bash login shell, it sends a SIGHUP to all children unless the shell option huponexit
is set to off.
When most userland processes receive a SIGHUP, they will exit.
You can also prefix the command with nohup
to make it ignore the SIGHUP. Moreover, you can disown
it using an internal bash function.
If you want backgrounded tasks to persist, look into using screen
To create or reconnect to a screen session called 'myprocess' which will persist across sessions:
To list all screens:
Yes it should. Apparently my answer was too short.