创建 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

Debian 9 没有 rc.local 文件,但有 rc.local 服务。
启动 rc-local 服务

systemctl start rc-local

把需要开机启动的命令添加到 /etc/rc.local 文件,写在 exit 0 前面,重启以后看效果。

标签: none

添加新评论