+
95
-

回答

vim /etc/rc.d/rc.local

在文件的末尾添加要执行的 Shell 程序的路径,例如:

/path/to/your/script.sh

确保替换 /path/to/your/script.sh 为你实际的 Shell 程序的路径。

保存并退出编辑器。

确保 rc.local 文件具有执行权限:

sudo chmod +x /etc/rc.d/rc.local

sudo chmod +x  /path/to/your/script.sh

重新启动系统,你的脚本应该会在启动时自动执行。

网友回复

我知道答案,我要回答