CentOS中如何使用systemctl管理系统服务

535
2024/3/2 12:04:41
栏目: 智能运维
开发者测试专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

在CentOS中,可以使用systemctl命令来管理系统服务。以下是一些常用的systemctl命令:

  1. 启动一个服务:
sudo systemctl start <service_name>
  1. 停止一个服务:
sudo systemctl stop <service_name>
  1. 重启一个服务:
sudo systemctl restart <service_name>
  1. 重新加载配置文件:
sudo systemctl reload <service_name>
  1. 查看服务状态:
sudo systemctl status <service_name>
  1. 启用一个服务,使其在系统启动时自动启动:
sudo systemctl enable <service_name>
  1. 禁用一个服务,使其在系统启动时不自动启动:
sudo systemctl disable <service_name>
  1. 查看所有已启用的服务:
sudo systemctl list-unit-files --state=enabled
  1. 查看所有正在运行的服务:
sudo systemctl list-units --type=service

以上是一些常用的systemctl命令,可以帮助您管理CentOS系统中的各种服务。

辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

推荐阅读: centos怎么修改ssh端口