标签:
/*********************************************************************
* Author : Samson
* Date : 02/04/2015
* Test platform:
* 3.13.0-24-generic
* GNU bash, 4.3.11(1)-release
* *******************************************************************/
With Upstart 0.6.7, to stop Upstart automatically starting a job, you can either:
To re-enable the job, just undo the change.
3、从Upstart 1.3版本开始,提供了一种新的方法,覆盖文件的方法,即对对应的配置文件的内容进行覆盖重写,
例如:
# echo "manual" >> /etc/init/myjob.override
表示myjob的任务或服务只能够进行手动启动;
还可以直接覆盖*.conf文件,如:
# echo "manual" >> /etc/init/myjob.conf
但这样的操作的话,会在恢复的时候原始的配置文件就不一定能够找到了;
With Upstart 1.3, you can make use of an "override file" and themanual stanza to achieve the same result in a simpler manner[31]:
# echo "manual" >> /etc/init/myjob.override
Note that you could achieve 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 remove themanual stanza 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、其实,还有一种方法也是能够实现不让服务自动启动的,例子如下:
例如某服务的.conf配置文件中原来的start on 行的配置如下:
start on started mdm
上行配置的意思是说当前配置文件对应的服务自动启动是在mdm服务已经启动起来的前提下,那如何进行disable这个服务不自动启动呢?就用disable就行了 ;-(, 如下:
start on started disabled and mdm
这样在再次启动时就不会再进行自启动了;
以上四种方法都能够实现对某个任务或服务的自动启动进行失效,但是若是考虑到软件升级的问题的话,还是第三种方法:使用myjob.override的方法更好,因为myjob.conf文件本身并没有变化,所以并不会造成就此文件变化了后要进行升级的操作,当下次进行升级的时候也不会影响自己修改过的任务的配置,这是作为一个快速响应及长期维护的运维角度要去考虑的问题;
Ref:
http://upstart.ubuntu.com/cookbook/#disabling-a-job-from-automatically-starting
使Upstart机制下的服务在系统启动时自动启动失效的三种方法+1
标签:
原文地址:http://blog.csdn.net/yygydjkthh/article/details/43483669