Linux_ServicesManagement_RHEL7

目录

Network Manager

注意:network services和NetworkManager会有冲突,建议永久关闭network services
开启Network Manager
在网卡配置文件中加入:NM_CONTROLLRD=yes 开启Network Manager
NM_CONTROLLED是Network Manger的参数,实时生效,编辑网卡配置后会立即生效。
nmcli指令依赖NetworkManagwr服务。

RHEL7的服务管理systemctl指令

RHEL7中引入了systemctl作为系统服务的管理指令,下面介绍systemctl的用法。

服务的启动、停止、重载、重启

systemctl start|stop|reload|restart serviceName

系统服务启动脚本文件路径:/usr/lib/systemd/system

服务的分类

service服务

systemctllist-units --type service #列出所有services

target开机级别:target是多个services或target的集合

systemctl list-units --type target#列出所有的target
systemctl get-default  #显示默认开机级别
systemctl set-default TAB  #设定下次开机的启动级别

指令选项

systemctl enable serviceName#开机服务自启动
systemctl disable serviceName    #下次开机不自启动服务
systemctl is-enable serviceName     #显示服务下次开机是否启动
systemctl is-active serviceName     #显示服务是否在运行   
systemctl list-units     #列出当前所有服务的状态
systemctl list-unit-files     #列出所有类型下次开机的状态
systemctl list-dependencies sshd.service    #列出服务启动所依赖的服务
systemctl mask/unmask serviceName  #锁定/解锁服务
systemctl list-units --type serviceName  #列出某种类型的状态

还有下列选项:建议使用帮助手册查看使用说明
exited 运行完
waiting 等待其他服务
running 正在运行
inactive 服务Stop
static 其他服务依赖的服务,不需要设定自启动,会有需要的时候被自动激活

Jmilk

相关阅读:

原文地址:https://www.cnblogs.com/hzcya1995/p/13311017.html