我正在尝试了解 Linux init 系统。我不明白如何存在三个相互竞争的系统,但该service
命令似乎对所有系统都有效。
从服务命令man
页面:
服务运行 System V init 脚本或 upstart 作业...
我正在使用 lubuntu 16.4 我认为systemd 是默认的初始化系统(将pstree
systemd 显示为 root 进程)。服务的手册页中没有提到 Systemd。但是我仍然使用它来启动和停止脚本。
谁能解释这是为什么?
一些发行版选择包含兼容性脚本,以便旧式命令仍然有效。例如,在 Debian 8 上。
root@matrix:~# which service
/usr/sbin/service
root@matrix:~# file /usr/sbin/service
/usr/sbin/service: POSIX shell script, ASCII text executable, with very long lines
root@matrix:~# grep upstart /usr/sbin/service
# Operate against system upstart, not session
&& initctl version 2>/dev/null | grep -q upstart \
# Upstart configuration exists for this job and we're running on upstart
# Action is a valid upstart action
root@matrix:~# grep systemd /usr/sbin/service
is_systemd=
if [ -d /run/systemd/system ]; then
is_systemd=1
# On systems using systemd, we just perform a normal restart:
# A restart with systemd is already a full restart.
if [ -n "$is_systemd" ]; then
# When this machine is running systemd, standard service calls are turned into
if [ -n "$is_systemd" ]
# the systemd service file does not (yet) support reload for a
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1127 次 |
最近记录: |