这两天反复遇到使用systemctl的场景,由于systemctl是7.x版本最新的负责控制systemd系统和服务管理器的命令,所以这里把它大致的命令列一下
systemctl start httpd.service
systemctl restart httpd.service
systemctl stop httpd.service
systemctl reload httpd.service
systemctl status httpd.service
对某个服务或者单元启用、重启、停止、重载、查询状态
systemctl kill httpd
使用systemctl命令杀死服务
systemctl list-unit-files
列出所有可用单元
systemctl list-units
列出所有运行中单元
systemctl –failed
列出所有失败单元
systemctl is-enabled crond.service
检查某个单元(如 cron.service)是否启用
systemctl status firewalld.service
检查某个单元或服务是否运行
systemctl –version
检查你的系统中是否安装有systemd并确定当前安装的版本
whereis systemctl
检查systemd和systemctl的二进制文件和库文件的安装位置
ps -eaf | grep [s]ystemd
检查systemd是否运行
systemd-analyze
分析systemd启动时各阶段消耗的时间
systemd-analyze blame
分析启动时各个进程花费的时间
systemd-analyze critical-chain
分析启动时的关键链
参考文档
systemctl 命令完全指南
Centos7下的systemctl命令与service和chkconfig