rsync服務啓動腳本,通過chkconfig來管理開機自啓動

實驗環境:

OS:CentOS 6.8

[root@sky9896 /]# chkconfig --add rsyncd 

rsyncd 服務不支持 chkconfig

[root@sky9896 /]# cat /etc/init.d/rsyncd 

#/bin/bash

# chkconfig: 2345 20 80    #添加該條即解決服務支持chkconfig


[root@sky9896 /]# chkconfig --add rsyncd

[root@sky9896 /]# chkconfig --list rsyncd

rsyncd          0:關閉  1:關閉  2:啓用  3:啓用  4:啓用  5:啓用  6:關閉


[root@sky9896 /]# /etc/init.d/rsyncd start  

-bash: /etc/init.d/rsyncd: 權限不夠


[root@sky9896 /]# chmod 777 /etc/init.d/rsyncd   #授權後,即解決

[root@sky9896 /]#  /etc/init.d/rsyncd start    #啓動服務 

rsyncd is started.

[root@sky9896 /]# netstat -lnt|grep 873    

tcp        0      0 0.0.0.0:873           0.0.0.0:*        LISTEN      

tcp        0      0 :::873         


設置開機自啓動的過程:

[root@sky9896 /]# chkconfig --add rsyncd  #添加服務

[root@sky9896 /]# chkconfig --list rsyncd  #顯示服務

rsyncd  0:關閉  1:關閉  2:啓用  3:啓用  4:啓用  5:啓用  6:關閉

[root@sky9896 /]# chkconfig --del rsyncd  #刪除該服務

[root@sky9896 /]# chkconfig --list rsyncd

rsyncd 服務支持 chkconfig,但它在任何級別中都沒有被引用(運行“chkconfig --add rsyncd”)


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章