Linux| Linux服务介绍(Service,systemctl)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u011479200/article/details/88059199

一.简介

Linux服务管理是Linux系统管理员的一个基本工作。现在让我们来看看用systemd怎么管理Linux服务管理。

现在大多数Linux服务管理系统开始使用systemd来管理服务了。
  Linux服务管理的systemd是一种智能的服务启动方法,Linux服务管理会在服务需求启动的时候自动启动。那么怎么使用Linux服务管理的systemd来管理服务呢?使用Linux服务管理的systemctl命令加上要执行的操作,最后是Linux服务管理名称。
  和系统直接显示Linux服务管理的journald这个日志服务一样,Linux服务管理的 systemctl显示当前服务状态的更详细信息。Linux服务管理的Service httpd status只能查看服务的状态,如只显示如果Linux服务管理是否处于运行状态,而Linux服务管理的systemctl status httpd则可以显示整个服务的子线程,关联进程状态等更详细的信息。
  使用Linux服务管理的systemctl启动和停止服务非常简单。例如,使用Linux服务管理的systemctl start httpd可以启动httpd,或systemctl stop httpd可以停止httpd服务。
  Linux服务管理的Systemd同时去掉了运行级别的区分。Linux服务管理只需要通过systemctl enable 服务名和systemctl disable 服务名来启用和禁用服务。


二.使用systemctl管理服务和程序

启动一个服务:systemctl start firewalld.service
关闭一个服务:systemctl stop firewalld.service
重启一个服务:systemctl restart firewalld.service
显示一个服务的状态:systemctl status firewalld.service

在开机时启用一个服务:systemctl enable firewalld.service
在开机时禁用一个服务:systemctl disable firewalld.service
查看服务是否开机启动:systemctl is-enabled firewalld.service;echo $?

查看已启动的服务列表:systemctl list-unit-files|grep enabled

猜你喜欢

转载自blog.csdn.net/u011479200/article/details/88059199
今日推荐