How to keep the process running after the shell exits
Source: Internet
Author: User
How to keep the process running after the shell exits-Linux general technology-Linux programming and kernel information. The following is a detailed description. It usually takes a long time to run some monitoring tools or disk check tasks in shell. In this case, if the user logs out, these programs will receive the SIGHUP signal to terminate. Obviously, this is not the case.
The nohup and bash built-in commands disown can solve this problem.
1. nohup
Nohup [command]
After running this command, the command ignores the SIGHUP signal during execution.
If there is no redirection to the standard output in command, nohup will output the standard output and standard error to the nohup. out file, which exists in the current directory or home directory.
At this time, the user logout and command will continue to run
2. disown
Disown-h jobnumber
Jobnumber is obtained by jobs.
This command causes the background command to ignore the SIGHUP signal.
Disown-ar
All background commands ignore the SIGHUP signal.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service