CentOS 7 上systemctl 的用法

來源:互聯網
上載者:User

標籤:centos 7   systemctl httpd


CentOS 7 上systemctl 的用法

我們對service和chkconfig兩個命令都不陌生,systemctl 是管制服務的主要工具, 它整合了chkconfig 與 service功能於一體。

systemctl is-enabled iptables.service

systemctl is-enabled servicename.service #查詢服務是否開機啟動
systemctl enable *.service #開機運行服務
systemctl disable *.service #取消開機運行
systemctl start *.service #啟動服務
systemctl stop *.service #停止服務
systemctl restart *.service #重啟服務
systemctl reload *.service #重新載入服務組態檔
systemctl status *.service #查詢服務運行狀態
systemctl --failed #顯示啟動失敗的服務

註:*代表某個服務的名字,如http的服務名為httpd

例如在CentOS 7 上安裝http

[[email protected] ~]# yum -y install httpd
啟動服務(等同於service httpd start)
systemctl start httpd.service
停止服務(等同於service httpd stop)
systemctl stop httpd.service
重啟服務(等同於service httpd restart)
systemctl restart httpd.service
查看服務是否運行(等同於service httpd status)
systemctl status httpd.service
開機自啟動服務(等同於chkconfig httpd on)
systemctl enable httpd.service
開機時禁用服務(等同於chkconfig httpd on)
systemctl disable httpd.service
查看服務是否開機啟動 (等同於chkconfig --list)




CentOS 7 上systemctl 的用法

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.