Three methods for making the services under the Upstart mechanism automatically start and expire at system startup + 1. upstart Mechanism

Source: Internet
Author: User

Three methods for making the services under the Upstart mechanism automatically start and expire at system startup + 1. upstart Mechanism

/********************************************************************* * Author  : Samson * Date    : 02/04/2015 * Test platform: *              3.13.0-24-generic *              GNU bash, 4.3.11(1)-release  * *******************************************************************/

Upstart's official server modification method illustrates three methods to achieve this function:
In section 11.44 Disabling a Job from Automatically Starting, the three methods are described: Starting from Upstart 0.6.7, the function of Automatically Starting a task of Upstart is invalid, you can achieve this in two ways:
1. Modify the name *. conf of the Automatic startup script of a task or service to end with a non-. conf name;
2. Edit the content in the *. conf file and add '#' to the line header of the start on line to make the start on line a comment line;
If the preceding two methods are to be restored after configuration, perform reverse operations;

With Upstart 0.6.7, to stop Upstart automatically starting a job, you can either:

  • Rename the job configuration file such that it does not end". Conf".
  • Edit the job configuration file and comment out"Start on"Stanza using a leading '#'.

To re-enable the job, just undo the change.

3. Starting from Upstart 1.3, a new method is provided to overwrite the file, that is, to overwrite the content of the corresponding configuration file,

For example:

# Echo "manual">/etc/init/myjob. override
Indicates that myjob tasks or services can only be started manually;
You can also directly overwrite the *. conf file, for example:
# Echo "manual">/etc/init/myjob. conf
However, the original configuration file may not be found during restoration;

With Upstart 1.3, you can make use of an "override file" andManualStanza to achieve the same result in a simpler manner [31]:

# echo "manual" >> /etc/init/myjob.override

Note that youCocouldAchieve the same effect by doing this:

# echo "manual" >> /etc/init/myjob.conf

However, using the override facility means you can leave the original job configuration file untouched.

To revert to the original behaviour, either delete or rename the override file (or removeManualStanza from your". Conf"File ).

For Session Jobs, note that if an override already exists "higher" up the search path, only that override file will apply: you cannot override an override file.

4. In fact, there is also a way to prevent the service from starting automatically, for example:

For example, the original start on line configuration in the. conf configuration file of a service is as follows:

Start on started mdm

The uplink configuration means that the service automatically starts corresponding to the current configuration file on the premise that the mdm service has been started up. How can we disable automatic start of the disable service? Just use disable;-(, as shown below:

Start on started disabled and mdm

In this way, no auto-start will be started again;


The above four methods can be used to enable automatic startup of a task or service. However, if the software upgrade problem is taken into account, the third method is to use myjob. the override method is better, because myjob. the conf file does not change, so it will not cause the upgrade operation after the file changes. The configuration of the modified task will not be affected during the next upgrade, this is a problem to be considered as a fast response and long-term maintenance O & M perspective;


Ref:

Http://upstart.ubuntu.com/cookbook/#disabling-a-job-from-automatically-starting

Http://overtag.dk/wordpress/2011/02/headaches-over-disablingenabling-services-init-d-scripts-in-ubuntu-10-10/

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.