CentOS 7.0 systemd

來源:互聯網
上載者:User

標籤:

CentOS 7 已經切換到 systemd,系統指令也有所變化。之前用於啟動、重啟、停止各種服務的service 作為向後相容的指令還能使用,但是將來可能會消失。同時,chkconfig 也改成了systemctl 了。這裡列舉了一些常用的對應於 service 和 chkconfig 的新的 systemctl 指令。

在目前的 CentOS 7(或 RHEL 7)系統中,依然可以使用 service 指令。例如,

[[email protected] ~]# service network restart

Restarting network (via systemctl):                        [  OK  ]

 

[[email protected] ~]# service httpd restart

Redirecting to /bin/systemctl restart  httpd.service

 

[[email protected] ~]# service sshd restart

Redirecting to /bin/systemctl restart  sshd.service

但是系統會自動重新導向該指令到新的指令 /bin/systemctl 來執行,並給出提示。

是時候切換到新的指令格式了,直接使用 systemctl 吧。這個指令的意思就是 system contrl。下面是一些常用的例子:

啟動服務:

systemctl start httpd

停止服務:

systemctl stop httpd

重啟服務(先停止,後啟動):

systemctl restart httpd

重新載入(使用新的設定檔):

systemctl reload httpd

顯示服務狀態:

systemctl status httpd

與此同時,之前用於設定系統啟動時自動運行某服務的指令 chkconfig 也改了,還是用systemctl。

chkconfig service on

改成了,

systemctl enable httpd

chkconfig service off

改成了,

systemctl disable httpd

檢查服務狀態的

chkconfig service

改成了,

systemctl is-enabled httpd

列舉出所有服務的指令,

chkconfig –list

改成了,

systemctl list-unit-files --type=service

以前能指定服務 runlevel 的 –levels 也沒有了。慢慢適應吧。

 

CentOS 7.0 systemd

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.