service和systemctl的區別

原文鏈接:https://www.linuxprobe.com/rhel-service-systemctl.html
導讀 本文檔介紹RHEL6的service和RHEL7的systemctl的區別

運行級別概念的區分

System V init 運行級別	systemd 目標名稱	作用
0	runlevel0.target, poweroff.target	關機
1	runlevel1.target, rescue.target	單用戶模式
2	runlevel2.target, multi-user.target	等同於級別 3
3	runlevel3.target, multi-user.target	多用戶的文本界面
4	runlevel4.target, multi-user.target	等同於級別 3
5	runlevel5.target, graphical.target	多用戶的圖形界面
6	runlevel6.target, reboot.target	重啓
emergency	emergency.target	緊急 Shell

systemctl 管理服務的啓動、重啓、停止、重載、查看狀態等常用命令區分

System V init 命令(RHEL 6)	systemctl 命令(RHEL 7)	作用
service foo start	systemctl start foo.service	啓動服務
service foo restart	systemctl restart foo.service	重啓服務
service foo stop	systemctl stop foo.service	停止服務
service foo reload	systemctl reload foo.service	重新加載配置文件(不終止服務)
service foo status	systemctl status foo.service	查看服務狀態

systemctl 設置服務開機啓動、不啓動、查看各級別下服務啓動狀態等常用命令

System V init 命令(RHEL 6)	systemctl 命令(RHEL 7)	作用
chkconfig foo on	systemctl enable foo.service	開機自動啓動
chkconfig foo off	systemctl disable foo.service	開機不自動啓動
chkconfig foo	systemctl is-enabled foo.service	查看特定服務是否爲開機自動啓動
chkconfig --list	systemctl list-unit-files --type=service	查看各個級別下服務的啓動與禁用情況

原文來自:https://www.linuxprobe.com/rhel-service-systemctl.html

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