Debian已自带rc-local服务,只是没有启动,也没有rc.local文件。
systemctl status rc-local 或者 service rc-local status 命令可以查看。
所以,如果想启用,我们只需要添加rc.local文件即可:
vim /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
中间写入要执行的命令。
千万不要忘记把文件的权限修改为可执行
chmod +x /etc/rc.local