[Operating System] Service Management

definition

A long-running process in memory that provides some system or network functionality

The essence of a service is a process, but it runs in the background, such as: mysql, sshd, firewall, etc., so we are also called a daemon ( daemon).

Classification

按照安装方式的不同,可分为:
1 - 使用rpm 安装包 安装的服务
	服务的安装位置按照 rpm包 设定好的目录;
	rpm包启动的服务通常会加入到系统服务目录中,通过 service、systemctl等 配合参数 可以启动。(如:systemctl start mysqld)
2 - 使用 源码包 编译安装的服务
	可以手动指定安装目录;
	源码包 安装的服务 默认需要 启动脚本文件 的绝对路径配合参数来启动 (如:/usr/local/nginx/sbin/nginx start)

The running status of the service

1 - active (running)	#运行中
2 - inactive(dead)	#停止状态

Supplement: kylin os three ways to manage services

1 - /etc/init.d/   #直接对该目录下的服务脚本进行管理
2 - service	#调用/etc/init.d/目录下的 服务脚本 管理服务
3 - systemctl	#是systemd对应的服务管理命令

View service running status

service

service service_name status

systemctl

systemctl status service_name 

Supplement:
download the rpm package, start the service, close the service, restart the service

一般麒麟系统自带的光驱里面
/media/Packages 中存着自带的rpm包
rpm -ivh rpm包名  # 安装服务
systemctl start 服务名称  #开启服务
systemctl stop 服务名称
systemctl restart 服务名称	#重启服务

# 修改了服务的配置文件,需要重载配置文件,重载服务
systemctl reload 服务名称 #注意服务在停止状态无法重载配置文件

######一般重载欸之文件过程:
1 - 开启服务
2 - 重载
####
systemctl start 服务名称
systemctl reload 服务名称

Service starts automatically

systemctl  is-enabled 服务名称  #查看服务是否开机自启
systemctl enable 服务名称 #开机自启
systemctl disable 服务名称	#关闭开机自启

Service query of linux system

centos6/rhel6

service firewalld status
service firewalld start

Guess you like

Origin blog.csdn.net/Sanayeah/article/details/126840618