systemctl操作
启动
systemctl start xxx
systemctl stop xxx
systemctl restart xxx
查看状态
systemctl status xxx
设置自启动
systemctl enable xxx
systemctl disable xxx
修改了unit之后
# 如/usr/lib/systemd/system、/etc/systemd/system中xxx.service,xxx.service.d的东西
systemctl daemon-reload
查看开机项
systemctl list-unit-files (查看开机启动项)
systemctl list-unit-files | grep 程序名称 (查看某些服务开机启动状态)
systemctl list-unit-files | grep enable (查看哪些为开机启动服务)
从失败的列表中删除unit
systemctl stop [servicename]
systemctl disable [servicename]
要重置所有状态为失败的unit:
systemctl reset-failed
或指定特定unit:
systemctl reset-failed xxx.service
CentOS修改了系统启动文件后执行systemctl daemon-reload报错
Error getting authority: Error initializing authority: Error calling StartServiceByName for org.freedesktop.PolicyKit1: Timeout was reached (g-io-error-quark, 24)
或
[bin]$ systemctl daemon-reload
** (pkttyagent:31514): WARNING **: Unable to register authentication agent: Timeout was reached
Error registering authentication agent: Timeout was reached (g-io-error-quark, 24)
Failed to execute operation: Connection timed out
解决办法安装polkit,再重载即可
yum -y install polkit