Systemctl命令的使用及服务状态

2018.05.23 1,848 0

Linux Systemctl是一个系统管理守护进程、工具和库的集合,用于取代System V、Service和chkconfig命令,初始进程主要负责控制systemd系统和服务管理器。通过Systemctl –help可以看到该命令主要分为:查询或发送控制命令给systemd服务,管理单元服务的命令,服务文件的相关命令,任务、环境、快照相关命令,systemd服务的配置重载,系统开机关机相关的命令。

启动服务

  1. 旧指令    service nginx start
  2. 新指令    systemctl start nginx.service

停止服务

  1. 旧指令    service nginx stop
  2. 新指令    systemctl stop nginx.service

重启服务

  1. 旧指令    service nginx restart
  2. 新指令    systemctl restart nginx.service

重新加载服务

  1. systemctl reload nginx.service

开机启动服务

  1. 旧指令    chkconfig –level 3 nginx on
  2. 新指令    systemctl enable nginx.service

开机禁用服务

  1. 旧指令    chkconfig –level 3 nginx off
  2. 新指令    systemctl disable nginx.service

所有已启动服务

  1. 旧指令    chkconfig –list
  2. 新指令    systemctl list-units –type=service

检查服务状态

  1. 旧指令    service nginx status
  2. 新指令    systemctl status nginx.service

启动失败的服务

  1. systemctl –failed
400

全部评论 0


    抢沙发