2016-06-21 78 views
0

我在Centos 7上使用安裝作爲init.d服務(系統V)的服務。如何使用centos7啓動服務啓動?

我希望在重啓後服務自動啓動。

我該怎麼做?

謝謝,我曾嘗試:

1- /sbin/chkconfig --add my-service 
2- /sbin/chkconfig --on my-service      
3- chkconfig --list:my-service 0:off 1:off 2:on 3:on 4:on 5:on 6:off               
4- /sbin/service my-service start           
5- reboot centos7              
6- /sbin/service my-service status: Not running       
The service does not start automatically 

回答

1

與systemd正確的方法是:

systemctl enable myservice 

如果這是你反正可以用chkconfig一個initv服務(可能安裝)

+0

謝謝使用chkconfig工作正常,我的服務中有一個小錯誤。 –