Centos7 開機自動啟動服務

2021-08-08 18:06:40 字數 624 閱讀 1208

第一種方法:

在 /etc/rc.d/rc.local 的檔案中新增你要開機啟動服務的絕對路徑;

第二種方法:

寫乙個指令碼(用stop或satart來控**務的啟動), 把這個指令碼放入: /etc/rc.d/init. d 中並給它可執行許可權(chmod a+x); 這樣就可以用service啟動啦,

如果你還想開機啟動的話, 就把:

# chkconfig: 2345 10 90

# description: activates/deactivates all *** inte***ces configured to \

# start at boot time.

放入指令碼中, 位於

#!/bin/bash

之後,  再用命令:

chkconfig --add 指令碼名

到這一步就ok了, 可以用chkconfig --list檢視, 指令碼有沒有在裡面;

如果考慮當前的啟動級別的話, 可以用chkconfig --level來設定;

centos 7 設定開機啟動服務

2018 12 25 centos7下新增開機自啟動指令碼和服務的方法 以docker 服務為例 1 centos7自帶命令設定 systemctl enable docker.service 2 設定開機指令碼啟動 vi etc rc.d rc.local 新增以下內容 sh mnt start....

Centos7開機啟動程式

1.自己新建乙個指令碼,如centnet service.sh mkdir centnet 建立檔案 centnet service.sh 經過後面的幾個步驟後,這個指令碼在開機的時候會執行,在這個指令碼裡面可以寫你開機的時候想執行的命令,如啟動tomcat,oracle等服務 2.在指令碼中輸入啟...

centos 7 開機啟動配置

centos 7 開機啟動 1 開機啟動配置檔案位於 usr lib systemd system 2 nginx的配置 unit description nginx high performance web server after network.target remote fs.target ...