linux7 chkconfig,centos 6-7 chkconfig -systemctl关系对比
CentOS 7 已經(jīng)切換到 systemd,系統(tǒng)指令也有所變化。之前用于啟動(dòng)、重啟、停止各種服務(wù)的 service 作為向后兼容的指令還能使用,但是將來(lái)可能會(huì)消失。同時(shí),chkconfig 也改成了 systemctl 了。這里列舉了一些常用的對(duì)應(yīng)于 service 和 chkconfig 的新的 systemctl 指令。
在目前的 CentOS 7(或 RHEL 7)系統(tǒng)中,依然可以使用 service 指令。例如,
[root@localhost ~]# service network restart
Restarting network (via systemctl): [ OK ]
[root@localhost ~]# service httpd restart
Redirecting to /bin/systemctl restart httpd.service
[root@localhost ~]# service sshd restart
Redirecting to /bin/systemctl restart sshd.service
但是系統(tǒng)會(huì)自動(dòng)重定向該指令到新的指令 /bin/systemctl 來(lái)執(zhí)行,并給出提示。
是時(shí)候切換到新的指令格式了,直接使用 systemctl 吧。這個(gè)指令的意思就是 system control。下面是一些常用的例子:
啟動(dòng)服務(wù):
systemctl start httpd
停止服務(wù):
systemctl stop httpd
重啟服務(wù)(先停止,后啟動(dòng)):
systemctl restart httpd
重新加載(使用新的配置文件):
systemctl reload httpd
顯示服務(wù)狀態(tài):
systemctl status httpd
與此同時(shí),之前用于設(shè)定系統(tǒng)啟動(dòng)時(shí)自動(dòng)運(yùn)行某服務(wù)的指令 chkconfig 也改了,還是用 systemctl。
chkconfig service on
改成了,
systemctl enable httpd
chkconfig service off
改成了,
systemctl disable httpd
檢查服務(wù)狀態(tài)的
chkconfig service
改成了,
systemctl is-enabled httpd
列舉出所有服務(wù)的指令,
chkconfig –list
改成了,
systemctl list-unit-files –type=service
以前能指定服務(wù) runlevel 的 –levels 也沒有了。慢慢適應(yīng)吧。?
總結(jié)
以上是生活随笔為你收集整理的linux7 chkconfig,centos 6-7 chkconfig -systemctl关系对比的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: qt中QHostAddress与QStr
- 下一篇: java读取excel某个单元格的值_[