服务管理简介

在这里插入图片描述

service常见用法

查看系统所有的后台服务进程

# 查看系统所有的后台服务进程
service --status-all

查看指定的后台服务进程的状态

# 查看指定的后台服务进程的状态
service sshd status

停止服务

# 停止服务
service sshd stop

启动服务

# 启动服务
service sshd start

重启服务

# 重启服务
service sshd restart

配置后台服务进程的开机自启

查看服务是否自启动

## chkconfig 服务名 --list
chkconfig iptables --list

## 如果在任意一个启动级别上是on,都代表自启动

在这里插入图片描述

让httpd服务开机自启

# 让httpd服务开机自启
chkconfig httpd on

让httpd服务开机不自启

# 让httpd服务开机不自启
chkconfig httpd off