Recent Changes - Search:

Basics

Languages

Tools

OS

Resources

PmWiki

pmwiki.org

edit SideBar

OfflineWork

Generally, when you logout, your shell sends a hangup (HUP) signal to every child process. Some server-type binaries will automatically ignore a HUP, but a script runs in bash, and bash exits. So you have to protect it with 'nohup'. This is especially useful when connecting to the remote computer, to launch a script in the background (&) and then move on to doing other things with your local computer without needing to keep the connection active. This is achieved with the following syntax:

nohup ./script.sh &

It might be necessary, and it is definitely advised, to redirect input and output from the terminal to files, to get a command of the form:

nohup ./script.sh </dev/null >/dev/null 2>>script_err.log &

where /dev/null can also be replaced by files to write to, like in the case of error messages above (through the use of the 2>>).

Edit - History - Print - Recent Changes - Search
Page last modified on May 24, 2018, at 05:19 PM