Automatically starts after the Linux process exits

Source: Internet
Author: User

/********************************************************************** * Automatic startup after Linux process exits * Description: * In the system, we sometimes want the daemon to be able to run all the time, even if the program is wrong, * also want the program to start automatically, and continue to run. * 2016-12-10 Shenzhen Nanshan Ping Shan village Zengjianfeng ************************************************************* ********/One, reference document: How to automatically restart a Linux background processifIt fails?http://superuser.com/questions/507576/how-to-automatically-restart-a-linux-background-process-if-it-failsSecond, the solution:1as described in the reference documentation, there are three cases:1. BusyBox init: In/etc/inittab Add::: respawn:/bin/myprocess2. Linux"System V"Init: In/etc/added in Inittab: myprocess:2345: respawn:/bin/myprocess3. SYSTEMD:1. In/etc/systemd/system/added in Myprocess.service: [Unit] Description=My Process [Service] Execstart=/bin/myprocess Restart=Always [Install] Wantedby=multi-User.target2. Systemctl Enable Myprocess.service2For more information, please refer to: http://Buildroot.uclibc.org/downloads/manual/manual.html#_init_system            3. Systemctl Start Myprocess.service

Automatically starts after the Linux process exits

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.