什么是 rc 服务(或 rc.service)?

Dan*_*iel 6 services

$sudo systemctl status rc在我的 Ubuntu v18.04 中运行时,我注意到有这样一个服务:

? rc.service
   Loaded: masked (/dev/null; bad)
   Active: inactive (dead)
Run Code Online (Sandbox Code Playgroud)

谁能告诉我它是做什么的?

Ste*_*itt 6

Debian 的 systemd 添加了许多链接以防止运行过时的 initscripts:

# Those services are useless under systemd. Mask them so they can't
# be run manually by accident.
/dev/null /lib/systemd/system/sendsigs.service
/dev/null /lib/systemd/system/halt.service
/dev/null /lib/systemd/system/reboot.service
/dev/null /lib/systemd/system/rc.service
/dev/null /lib/systemd/system/rcS.service
Run Code Online (Sandbox Code Playgroud)

(在 systemd 中,将一个单元链接到/dev/null告诉 systemd 它被“屏蔽”了。)

Sorc.service的唯一目的是确保运行

systemctl start rc
Run Code Online (Sandbox Code Playgroud)

不会运行/etc/init.d/rc从其他一些初始化系统(file-rc,openrc并且sysv-rc都提供此文件)遗留下来的脚本。