systemctl [command] [unit]
command:
start:启动服务
stop:停止服务
restart:重启服务
status:查看服务状态
reload:不关闭 unit 的情况下,重新载入配置文件,让设置生效,修改配置文件之后可用该命令
mask:注销 unit,注销后你就无法启动这个 unit 了
unmask:取消对 unit 的注销
结果解析:
active(running):正有一个或多个程序正在系统中执行
atcive(exited):仅执行一次就正常结束的服务, 目前并沒有任何程序在系統中执行
atcive(waiting):正在执行当中,不过还在等待其他的事件才能继续处理
atcive(dead):程序退出
查看系统所有已经启动的unit
systemctl list-units
查看系统正在运行的服务
systemctl list-units|grep running
查看系统装了的所有unit
systemctl list-unit-files
查看enable的服务
systemctl list-unit-files |grep enabled