systemd和systemctl
2016-02-05 12:44
281 查看
systemd
RHEL7全新的初始化进程:systemd,使用了并发启动机制,提升了开机速度。由于初始化进程的替换,原先的inittab不再起作用,也没有了“运行级别”的概念。
系统启动时做的大量初始化工作如挂载文件系统,启动各类进程服务等可以看作是一个个单元(Unit)
systemd与sysvinit运行级别的对应关系
例1. 将默认的运行级别修改为“多用户,无图形模式”
# ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
例2. 将默认的运行级别修改为“图形化模式”
# ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target
systemctl
RHEL7系统的管理服务命令从service改为systemctl。
systemctl管理服务命令
systemctl设置服务命令
参考文献:http://www.linuxprobe.com/chapter-08/
RHEL7全新的初始化进程:systemd,使用了并发启动机制,提升了开机速度。由于初始化进程的替换,原先的inittab不再起作用,也没有了“运行级别”的概念。
系统启动时做的大量初始化工作如挂载文件系统,启动各类进程服务等可以看作是一个个单元(Unit)
[root@linuxprobe ~]# cat /etc/systemd/system/default.target # This file is part of systemd. # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version.[Unit]Description=Graphical Interface Documentation=man:systemd.special(7) Requires=multi-user.target After=multi-user.target Conflicts=rescue.target Wants=display-manager.service AllowIsolate=yes[Install]Alias=default.target
systemd与sysvinit运行级别的对应关系
Sysvinit运行级别 | Systemd目标名称 | 作用 |
0 | runlevel0.target, poweroff.target | 关机 |
1 | runlevel1.target, rescue.target | 单用户模式 |
2 | runlevel2.target, multi-user.target | 等同于级别3 |
3 | runlevel3.target, multi-user.target | 多用户的文本界面 |
4 | runlevel4.target, multi-user.target | 等同于级别3 |
5 | runlevel5.target, graphical.target | 多用户的图形界面 |
6 | runlevel.target, reboot.target | 重启 |
emergency | emergency.target | 紧急hell |
# ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
例2. 将默认的运行级别修改为“图形化模式”
# ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target
systemctl
RHEL7系统的管理服务命令从service改为systemctl。
systemctl管理服务命令
sysvinit命令(RHEL6系统) | systemctl命令(RHEL7系统) | 作用 |
service foo start | systemctl start foo.service | 启动服务 |
service foo restart | systemctl restart foo.service | 重启服务 |
service foo stop | systemctl stop foo.service | 停止服务 |
service foo reload | systemctl reload foo.service | 重新加载配置文件(不终止服务) |
service foo status | systemctl status foo.service | 查看服务状态 |
sysvinit命令(RHEL6系统) | systemctl命令(RHEL7系统) | 作用 |
chkconfig foo on | systemctl enable foo.service | 开机自动启动 |
chkconfig foo off | systemctl disable foo.service | 开机不自动启动 |
chkconfig foo | systemctl is-enabled foo.service | 查看特定服务是否为开机自启动 |
chkconfig --list | systemctl list-unit-files --type=service |
相关文章推荐
- 关于META-INF/services in JAR 的介绍
- 【CodeForces 312B】BUPT 2015 newbie practice #3A Archer
- junit设计模式--适配器模式
- noip2002-自由落体 2008.11.5
- noip2003传染病控制 2008.11.5
- junit设计模式--适配器模式
- linux下编译hadoop2.4.1源码
- VS2010中出现无法嵌入互操作类型
- JSP页面布局工具JWebBox升级到2.0版
- setInterval和setTimeout
- 人工智能、应用、程序
- Java [Leetcode 88]CMerge Sorted Array
- poj3233 Matrix Power Series (矩阵快速幂+二分)
- 关于accept 返回的socket的阻塞属性
- 字符串替换-K&R C 题3-2
- Windows DIB文件操作具体解释-5.DIB和调色板
- eclipse查看hadoop2源码
- 第一周学习总结
- hdoj 1596 find the safest road【最短路3种方法】
- sum=sum+a;关于此的初级解读