A background process is the process which executes behind the scenes. These processes run without user intervention. There are various way to do it for example using & or nohup or screen command. The most popular and frequently used are & and nohup. Including of these two options this tutorial will also describes you to use of screen command.
1. Using &
On Linux/Unix based systems we can easily send any process in background by appending & in command.
In this way if you start a command in background and exited from shell, then shell will kill this background process with SIGHUP signal.
2. Using nohup
To prevent termination of background processes after shell termination use nohup command. nohup command simply use at prefix of command like. All the output generated with commands will save in nohup.out file in current directory.
3. Using Screen
Screen is better option for long running processes. Using screen you can simply get the same session running on remote server even after logout from ssh. For this test you can do the following
Now start your process in background.
Let’s detach your screen session with keyboard shortcut CTRL+a+d or ctrl+alt+d. It will return you to command line. Now exit your ssh session and again connect system through ssh and execute following command to get old screen session running.
No comments:
Post a Comment