1. 程式人生 > >redhat6和redhat7服務管理命令對比

redhat6和redhat7服務管理命令對比

學習過紅帽RHEL6系統的一定知道使用service、chkconfig等命令來管理系統服務,而在紅帽RHEL7系統中管理服務的命令是”systemctl“,兩者使用方法大致相同,我們來做下對比! systemctl管理服務的啟動、重啟、停止、過載、檢視狀態的命令:

Sysvinit命令(紅帽RHEL6系統) Systemctl命令(紅帽RHEL7系統) 作用
service httpd start systemctl start httpd 啟動服務
service httpd restart systemctl restart httpd 重啟服務
service httpd stop systemctl stop httpd 停止服務
service httpd reload systemctl reload httpd 重新載入服務
service httpd status systemctl status httpd 檢視服務狀態

systemctl設定服務的開機啟動、不啟動、檢視各級別下服務啟動狀態的命令:

Sysvinit命令(紅帽RHEL6系統) Systemctl命令(紅帽RHEL7系統) 作用
chkconfig httpd on systemctl enable httpd 開機自動啟動
chkconfig httpd off systemctl disable httpd 開機不自動啟動
chkconfig httpd systemctl is-enabled httpd 檢視特定服務是否為開機自啟動
chkconfig --list systemctl list-unit-files --type=service 檢視各個級別下服務的啟動與禁用情況