Sal*_*lem 12 upstart services sysv
在 Ubuntu 中总是让我感到困惑的一件事是系统服务是如何启动的。我知道 Ubuntu 使用 Upstart 并支持 SysV,但是使用哪个启动服务?当您想要“手动”启动服务时,这很重要。
例如,在我的系统上,我在/etc/init.d/<service>
(SysV) 和/etc/init/<service>.conf
(Upstart) 中有以下服务的文件:
acpid, mysql, networking, qemu-kvm, ufw, libvirt-bin
Run Code Online (Sandbox Code Playgroud)
那么如果我想在启动时禁用 MySQL 执行,我必须使用 Upstart 方式或 SysV 方式来禁用它吗?另外,我怎么知道哪些是真正用于启动通用服务的?
这里真正的疑问不是如何使用 SysV/Upstart 禁用/启用服务。真正让我感到困惑的是,某些服务似乎同时在 SysV 和 Upstart 中定义(并启用)。它们之间是否有任何优先级(就像mysql
在使用 SysV 启动它时都启用了一样)?或者可能是一种工具在后台使用另一种工具?
它在很大程度上取决于应用程序及其包装维护者。
There is a strong preference for Upstart scripts because they handle events (which is generally a great thing) but a lot of applications don't have good enough Upstart scripts available or the application's maintainer has chosen to stick with the defaults (application or Debian's).
Either way, you're in the position where you have to adapt.
.conf
, ormanual
to the file. This will allow you to manually load the service.For older services:
update-rc.d -f <service> remove
Run Code Online (Sandbox Code Playgroud)If you have an /etc/init.d/
script for something and an /etc/init/
script and you want to check if the init.d version is still live, you can check with:
ls -l /etc/rc?.d/*<service>
Run Code Online (Sandbox Code Playgroud)
If you see a load of symlinks, it's installed in the old SysV init.
对于 SysV 和 upstart 中定义的服务,通常如果您通过 SysV 重新启动它,您会看到类似这样的内容:
al@al-mythtv:~$ sudo /etc/init.d/mysql restart
[sudo] password for al:
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mysql restart
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) and then start(8) utilities,
e.g. stop mysql ; start mysql. The restart(8) utility is also available.
mysql stop/waiting
mysql start/running, process 29846
Run Code Online (Sandbox Code Playgroud)
我的意思是,Upstart 是这些服务的首选,而 SysV 实现只是一个包装器。
另外,我认为你有向后目录的含义。/etc/init 是 upstart 配置,/etc/init.d 是 SysV 兼容性,但它只是这些类型服务的 upstart 的符号链接。
归档时间: |
|
查看次数: |
5083 次 |
最近记录: |