systemd初始化进程服务

centos7中systemd初始化进程服务

一、Linux操作系统启动过程

  1. 从BIOS启动 Boot Loader
  2. 引导Linux系统内核,进行内核初始化
  3. 开启初始化进程服务

RHEL6版本中,开启初始化进程服务是由 system V init 完成的

RHEL7版本中,开启初始化进程服务是由 systemd 完成的

由于初始化进程服务的改动,

使RHEL7中系统运行级别服务的启动管理 自启动管理,与RHEL6版本中的有些许不同

二、runlevel VS target

运行级别runlevel(在RHEL6中)target(在RHEL7)作用
0runlevel0.target poweroff.target关机
1runlevel1.target recue.target单用户模式,类似于window的安全模式
2runlevel2.target multi-user.target多用户字符命令模式
3runlevel3.target multi-user.target多用户字符命令模式
4runlevel4.target multi-user.target多用户字符命令模式
5runlevel5.target graphical.target多用户图形模式
6runlevel6.target重启
emergencyemergency.target紧急shell

三、systemctl管理服务的启动、重启、停止、重载、状态显示

service(RHEL6)systemctl(RHEL7)作用
service foo startsystemctl start foo.service(service可省略)开启服务
service foo restartsystemctl restart foo.service重启
service foo stopsystemctl stop foo.service停止
service foo reloadsystemctl reload foo.service重载,重新读取配置文件但不停止服务
service foo statussystemctl status foo.service查看特定服务的运行状态
systemctl list-units --type=service查看所有的服务,grep running

四、systemctl设置服务的开机自启动,不启动,查看系统各级别下服务启动状态

chkconfig(RHEL6)systemctl(RHEL7)作用
chkconfig foo onsystemctl enable foo.service设置服务开机自启
chkconfig foo offsystemctl disable foo.service设置服务开机不自启
chkconfig foosystemctl is-enabled foo.service查看特定服务是否为开机自启动
chkconfig --listsysremctl list-unit-files --type=service查看各个级别下服务的启动与禁用情况

foo.service 术语foobar是一个常见的无名氏化名,常被作为“伪变量”使用 ,还以为foo真的是什么服务,发发发发。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值