Compile the Linux service and set the startup (UBUNTU)

Source: Internet
Author: User

1. Write your own executable files, such as myservice. Sh.

2. write scripts for controlling execution, such as mytest,Be sure to add the executable permission. Otherwise, the unrecognized service will be reported,Put mytest in/etc/init. d. Note that the first 10 lines cannot be omitted. You can view the header information when starting the system.

Lsbinitscripts

3. sudo update-rc.d mytest defaults to join the service, and then you can useService mytestTo control

4. another option is trick. After you enter service mytest, press the tab key to automatically remind shell of the supported commands. You only need to add the content in the red box in the figure to the file,Note: The usage U is in uppercase, and all commands are enclosed in braces.

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.