(15)centos7 系统服务

   

centos7 服务启动脚本在 /usr/lib/systemd目录下

1.服务基本操作指令

systemclt [command] [unit]
#其中command包括:
#start 立即启动
#stop 立即关闭
#restart 重启
#status 状态
#reload 不关闭的情况下重新加载配置文件
#enable 下次开机时会被启动
#disbale 下次开机时禁止启动
#is-active 是否正在运行
#is-enable 是否开机默认启动

 

 开机是否启动

当前运行状态

#Active几种状态:
    #active(running) 正在运行     
    #active(exited) 仅执行一次就正常结束的服务
    #active(waiting) 等待其他事件发生时运行
    #inactive 没有运行

2.查看系统服务列表

system [command] [--type=TYPE] [--all]

command包括:

(1)

list-units  显示目前启动的服务,加 --all 会加上未启动的服务所有服务

 

 (2)

list-init-files /usr/lib/systemd/system 文件列表

--type=TYPE

type类型有:service socket target 等

3.运行级操作

systemctl poweroff  关机
systemctl reboot 重启     
等

4.相关目录

 

5.创建服务

原文地址:https://www.cnblogs.com/buchizaodian/p/11136393.html