赞
踩
在Ubuntu系统中设置开机启动命令,您可以按照以下步骤进行操作:
startup.sh:sudo nano /etc/init.d/startup.sh
myprogram的程序,您可以将以下内容添加到脚本文件中:- #!/bin/bash
- /path/to/myprogram
请将 /path/to/myprogram替换为实际程序的路径。
sudo chmod +x /etc/init.d/startup.sh
sudo update-rc.d startup.sh defaults
现在,您的启动脚本将在每次系统启动时自动执行。请确保在脚本中指定的命令或程序的路径正确无误。您可以通过编辑脚本文件来调整启动行为和添加其他命令。
注意:从Ubuntu 16.04开始,使用 /etc/init.d/目录下的启动脚本已经过时,推荐使用 /etc/systemd/system/目录下的systemd服务单元进行管理。如果您使用的是较新的Ubuntu版本,请考虑使用systemd来设置开机启动。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。