10.26 unit介绍

unit介绍

  • ls /usr/lib/systemd/system //系统全部unit,分为如下类型:
    • service 系统服务
    • target 多个unit组成的组
    • device 硬件设备
    • mount 文件系统挂载点
    • automount 自动挂载点
    • path 文件或路径
    • scope 不是由systemd启动的外部进程
    • slice 进程组
    • snapshot systemd快照
    • socket 进程间通讯套接字
    • swap swap文件
    • timer 定时器

unit相关的命令

  • systemctl list-units //列出正在运行的unit
    • 并会提示,若要列出全部的units,则须要加 --all
  • systemctl list-units --all //列出全部,包括失败的或者inactive的
  • systemctl list-units --all --state=inactive //列出inactive的unit
  • systemctl list-units --type=service //列出状态为active的service
    • 其中failed是一个特例,也会列出来
  • systemctl is-active crond.service //查看某个服务是否为active
相关文章
相关标签/搜索