How to keep the process running after the shell exits

Source: Internet
Author: User

It usually takes a long time to run some monitoring tools or disk check tasks in shell.ProgramThe sighup signal is received to terminate the operation. 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

The sighup signal is ignored for all background commands.

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.