【发布时间】:2017-06-28 08:44:22
【问题描述】:
在 Debian 的最新稳定版本 Debian Stretch 中似乎没有 /etc/rc.local。它在哪里? /etc/rc.local 过时了吗?
【问题讨论】:
标签: debian
在 Debian 的最新稳定版本 Debian Stretch 中似乎没有 /etc/rc.local。它在哪里? /etc/rc.local 过时了吗?
【问题讨论】:
标签: debian
rc.local 已被弃用。
看来你仍然可以拥有一个:
cat <<EOF >/etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
exit 0
EOF
chmod +x /etc/rc.local
systemctl daemon-reload
systemctl start rc-local
systemctl status rc-local
● rc-local.service - /etc/rc.local Compatibility
Loaded: loaded (/lib/systemd/system/rc-local.service; static; vendor preset: enabled)
Drop-In: /lib/systemd/system/rc-local.service.d
└─debian.conf
Active: inactive (dead)
Condition: start condition failed at Wed 2017-06-28 11:32:36 UTC; 3min 13s ago
应启用供应商预设。您可以在 rc.local 中添加一些 echo 123 >/proof 并重新启动,确保它可以正常工作 - 我确认可以,使用 EC2 上的最后一个 Debian Stretch AMI,...
【讨论】:
/etc/rc.local是从/etc/init.d/rc.local调用的,后者属于initscripts包。至少如果您安装了 SysV init。
rc-local.service 来调用/etc/rc.local。如果我需要比echo hello world 更大的东西,它就不起作用了 - 软件包安装、数据库配置、模块配置。
/etc/rc.local was superseded in 1983. 可能是时候习惯了。 (-:
/etc/rc.local 不是从 /etc/init.d/rc.local 调用的(至少在我今天刚刚安装的 Debian 伸展系统上),因为 /etc/init.d/rc.local在那个系统中不存在。
【讨论】: