Debian 9中的rc.local在哪里(Debian Stretch)

时间:2017-06-28 08:44:23

标签: debian

似乎最新的稳定版Debian中没有/etc/rc.local Debian Stretch 。它在哪里? /etc/rc.local是否已过时?

2 个答案:

答案 0 :(得分:55)

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

应启用供应商预设。您可以将一些echo 123 >/proof添加到您的rc.local并重新启动,确保它有效 - 我确认它使用EC2上的最后一个Debian Stretch AMI,...

答案 1 :(得分:0)

/etc/rc.local不会从/etc/init.d/rc.local调用(至少在我今天刚刚安装的Debian Stretch系统上),因为/etc/init.d/rc.local该系统中不存在。