systemd系统服务控制相关命令

systemd相关命令ssh

pstree
   查看systemd的结构树

systemd-analyze (time)
   启动系统到登陆界面的时间,分为kernel和Userspace两部分

systemd-analyze blame
   启动过程当中各服务的花费的时间

systemd-analyze verify
   显示全部系统单元中是否有语法错误

systemd-analyze plot > boot.svg
   将整个引导过程写入一个Svg格式文件中以便分析(/home/username,用户文件夹下)

如下systemctl服务管理命令,自己列出运行中的服务清单

systemctl list-units
   不带多余信息列出运行中的服务清单

systemctl --all --no-pager | grep -i not-found
   查看挂掉的服务
   sudo systemctl mask ***.service
       把挂掉的服务踢掉
   
systemctl --failed
   列出运行失败的服务及缘由

systemctl start ***.service
   启动目标服务(***)

systemctl stop ***.service
   关闭目标服务(***)

systemctl restart,tyr-restart,reload ***.service
   重启(运行中)或启动(未运行),重启(只在运行中的),从新加载(配置文件)

systemctl status ***.service
   检查服务状态
systemctl enable/disable ***.service

   设置服务可或不可开机启动

systemctl is-enabled ***.service
   检查服务是否开机启动

远程管理
systemctl status sshd -H users@address

电源管理
systemctl poweroff 关机
systemctl reboot 重启
systemctl suspend 待机
systemctl hibernate  休眠svg

相关文章
相关标签/搜索