The background program remains running after shell exits.

Source: Internet
Author: User
After the shell exits, the background program remains running on the liunx. if you want a process to run in the background, the most direct method is to use the & amp; symbol. for example, pingwww.baidu.com & amp; but in this way, the process becomes a job of the current shell. when the shell exits, the job will receive a signal, along... after the shell exits, the background program remains running on the liunx. if you want a process to run in the background, the most direct method is to use the & symbol. for example, ping www.baidu.com. to solve this problem, you can use the nohup command to allow the job to ignore the shell exit signal, or use other methods. since the background command as a shell sub-process will be killed when the shell exits, as long as the background command is not allowed as a shell sub-process. A simple method is to use subshell to call background commands. for example Art. sh #! /Bin/bash ping www.baidu.com & then call start in shell. sh .. /start. sh I guess although start. sh is the parent process of the ping command, but start. sh stops after running. the ping command becomes an orphan process and will be adopted by the init process. therefore, exiting shell does not interrupt the ping command.

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.