Nohup Resume Command Exit After Exit
nohup is a command used to ignore HUP signal. HUP signal is used to kill a shell command if the parent shell exits. Think that we logged in with ssh and run a command. But the command execution takes a lot of time. We need to log out. In normal sense if we log out our command execution will end. In this case we will provide nohup command to prevent command termination even the ssh logout. Nohup is natively provided by Linux distributions, Unix and BSD.
nohup COMMAND [ARG]...
Nohup is very easy command to use in previous syntax section as wee see. We will just provide command after nohup command we want to execute.
$ nohup top &
We have appended ampersand to make run our process in the background and not bind to the current terminal.
Find Nohup Example
In this example we will use
find command which will run even we will close current shell.
$ nohup find -size +1000k > big_files.txt &
We also use
& which sends the process background and gives current shell to us. This will gives us the message ignoring input and redirecting stderr to stdout like below.
Situations Of Nohup Usage
We can use nohup command in the following cases.
- Tomcat Server Restart
- Memory Check