CentOS 7 已经切换到 systemd,系统指令也有所变化。之前用于启动、重启、停止各种服务的service 作为向后兼容的指令还能使用,但是将来可能会消失。同时,chkconfig 也改成了systemctl 了。这里列举了一些常用的对应于 service 和 chkconfig 的新的 systemctl 指令。

在目前的 CentOS 7(或 RHEL 7)系统中,依然可以使用 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

但是系统会自动重定向该指令到新的指令 /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 也没有了。慢慢适应吧。

最新文章

  1. 12月22日《奥威Power-BI财务报表数据填报》腾讯课堂开课啦
  2. 网络之OSI&&TCP/IP比较
  3. iOS学习之GCD
  4. nrf51822裸机教程-RTC
  5. The new Portable Class Library for SQLite z
  6. FIO工具常用参数
  7. 【 D3.js 进阶系列 — 6.2 】 饼状图的拖拽
  8. css样式表中四种属性选择器
  9. HTML&JS笔记(1)
  10. leetcode N-QueensII
  11. vim设置注意记录
  12. recurrent model for visual attention
  13. 【BZOJ5417】[NOI2018]你的名字(线段树,后缀自动机)
  14. 从开启GTID功能的库同步数据到未开启GTID功能库时,注意事项!
  15. Web系统页面打印技术实现与分析
  16. 4.Python爬虫入门四之Urllib库的高级用法
  17. MFC函数——CWnd::OnEraseBkgnd
  18. typescripts学习
  19. SpringBoot与Dubbo整合下篇
  20. SQL基础操作

热门文章

  1. [CSS3]移动Web开发系列之CSS3增强型选择器
  2. 模式识别:利用MATLAB生成模式类
  3. CentOS——yum命令运行错误解决办法
  4. 仿新浪首页、主题、详情页,纯html静态页面
  5. C语言 | 基础知识点笔记
  6. mysql导出查询结果到文档
  7. 【SpringMVC学习04】Spring、MyBatis和SpringMVC的整合
  8. 走进windows编程的世界-----消息处理函数(3)
  9. nginx根据目录反向代理到后端服务器
  10. Wd 西部数据