Linux有12种Unit,对于个人来讲,用的最多的是Service Unit,下面的Unit均指Service Unit(服务单元)

 

# 启动Unit

systemctl start appname.service

# 停止Unit

systemctl stop appname.service

# 重启Unit

systemctl restart appname.service

 

# 重新加载Unit的配置文件

systemctl reload appname.service

# 重新加载所有Unit的配置文件

systemctl daemon-reload

tip:重新加载需要重新启动Unit才生效

 

# 开机启动Unit

systemctl enable appname.service

# 禁止开机启动Unit

systemctl disable appname.service

 

# 查看Unit状态

systemctl status appname.service

# 查看Unit是否运行

systemctl is-active appname.service

# 查看Unit是否启动失败

systemctl is-failed appname.service

# 显示Unit是否建立了启动链接

systemctl is-enabled appname.service

 

当然也可以使用 service命令对服务进行操作,具体可看这里

对于更完全的对 systemd,systemctl,Unit的解读,可看这里

 

相关文章:

  • 2021-12-27
  • 2022-12-23
  • 2022-12-23
  • 2021-05-27
  • 2022-12-23
  • 2022-01-25
  • 2021-07-14
猜你喜欢
  • 2022-01-19
  • 2022-12-23
  • 2021-07-14
  • 2022-12-23
  • 2021-12-30
  • 2021-07-01
相关资源
相似解决方案