centos7 開機自動執行sh

2021-10-12 07:37:38 字數 328 閱讀 1538

由於在centos7中/etc/rc.d/rc.local的許可權被降低了,所以需要賦予其可執行權

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

賦予指令碼可執行許可權

假設/opt/script/autostart.sh是你的指令碼路徑,給予執行許可權

2 chmod +x /opt/script/autostart.sh

開啟/etc/rc.d/rc/local檔案,在末尾增加如下內容

3 /opt/script/autostart.sh

執行不了看less /var/log/message

有可能是許可權問題 777

centos7 開機自動執行指令碼

1 因為在centos7中 etc rc.d rc.local的許可權被降低了,所以需要賦予其可執行權 chmod x etc rc.d rc.local 2 賦予指令碼可執行許可權 假設 usr local script autostart.sh是你的指令碼路徑,給予執行許可權 chmod x u...

Centos7 開機自動啟動服務

第一種方法 在 etc rc.d rc.local 的檔案中新增你要開機啟動服務的絕對路徑 第二種方法 寫乙個指令碼 用stop或satart來控 務的啟動 把這個指令碼放入 etc rc.d init.d 中並給它可執行許可權 chmod a x 這樣就可以用service啟動啦,如果你還想開機啟...

linux開機自動執行 sh指令碼

bin sh chkconfig 2345 20 80 description server reboot.execute auto.sh client post port 80 redirect 9527 sudo iptables a prerouting t nat i eth0 p tcp ...