CentOS中
查看服務列表
chkconfig –list
添加服務
chkconfig –add {servicename}
開啟服務
chkconfig {servicename} on
Fedora中
systemctl命令用法 對比表
以 apache / httpd 為例
任務:舊指令,新指令
使某服務自動啟動:chkconfig –level 3 httpd on,systemctl enable httpd.service
使某服務不自動啟動:chkconfig –level 3 httpd off,systemctl disable httpd.service
檢查服務狀態:service httpd status,systemctl status httpd.service (服務詳細信息) systemctl is-active httpd.service (僅顯示是否 Active)
顯示所有已啟動的服務:chkconfig –list,systemctl list-units –type=service
啟動某服務:service httpd start,systemctl start httpd.service
停止某服務:service httpd stop,systemctl stop httpd.service
重啟某服務:service httpd restart,systemctl restart httpd.service