systemctl命令使用

启动服务

systemctl start redis.service

 关闭服务

systemctl stop redis.service

重启服务 

systemctl restart redis.service

查看服务状态

systemctl status redis

 查看某个unit是否在运行

systemctl is-active redis.service

查看所有units

systemctl list-units --all

--type指定unit的类型,如service类型

systemctl list-units --type=service

--state指定unit的状态,active表示在运行,inactive表示停止运行

systemctl list-units --type=service --state=active

 修改服务配置后重新加载

systemctl reload redis.service

设置开机自启动

systemctl enable redis

 取消开机自启动

systemctl disable redis


版权声明:本文为qq_38269333原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。