Ubuntu設定軟體開機自啟動

2021-10-10 11:41:36 字數 776 閱讀 8742

1 修改/etc/rc.local

rc.local指令碼是乙個ubuntu開機後會自動執行的指令碼(重啟後),我們可以在該指令碼內新增命令列指令

在exit 0前新增命令即可

2 新建指令碼,將指令碼新增到啟動指令碼(推薦,可控,而且非常清楚)

2.1 在/etc/init.d/ 下新建指令碼*** 或者 ***.sh

#!/bin/bash

# command content

exit 0

2.2 設定檔案許可權

chmod 755 ***
2.3 將指令碼新增到啟動指令碼

update-rc.d *** defaults 90
(移除開機指令碼:update-rc.d -f *** remove)

3 適用於ubuntu 和 centos

參考:在/etc/init.d編寫指令碼命令後,比如命名為test,然後直接執行 systemctl enable test 或 systemctl enable test.service

4 檢視開機啟動項

ubuntu開機自啟動

update rc.d defaults nn命令 nn為啟動順序 將指令碼新增到初始化執行的佇列中去。注意如果指令碼需要用到網路,則nn需設定乙個比較大的數字,如99。1 將你的啟動指令碼複製到 etc init.d目錄下,以下假設你的指令碼檔名為 test。2 設定指令碼檔案的許可權 sudo ...

Ubuntu開機自啟動方法

1 新增rc.local服務super super sudo more etc systemd system rc local.service unit description rc.local conditionpathexists etc rc.local service type forkin...

ubuntu開機自啟動roslaunch程式

參考鏈結 建立star.sh bin bash source opt ros kinetic setup.bash source catkin ws devel setup.bash roslaunch x x.launch 增加star.sh許可權 sudo chmod 777 star.sh搜尋...