管理开机启动:systemd
一、CentOS7 systemd 介绍
在 CentOS7 中,使用 systemd 来管理其他服务是否开机启动,systemctl 是 systemd 服务的命令行工具
[root@localhost ~]$ systemctl start httpd.service # 启动服务
[root@localhost ~]$ systemctl stop httpd.service # 关闭服务
[root@localhost ~]$ systemctl restart httpd.service # 重启服务
[root@localhost ~]$ systemctl status httpd.service # 查看服务状态
[root@localhost ~]$ systemctl is-enabled httpd.service # 查看指定的服务是否开机启动
[root@localhost ~]$ systemctl enable httpd.service # 设置指定的服务开机启动
[root@localhost ~]$ systemctl disable httpd.service # 设置指定的服务开机不启动
二、CentOS7 unit 介绍
(1) CentOS7 中新增了 unit(单元)的概念,它是系统所有资源的统称,不同的资源称为不同的 unit(单元)
(2) 常见的 unit 有:Service Unit ( 系统服务 ) 、Device Unit ( 硬件设备 ) 、Path Unit ( 文件或路径 ) 等等
(3) Systemd 用来管理这些单元,它保存了系统服务、硬件设备、挂载点等单元的配置文件,并能够处理不同单元之间的依赖关系
(4) 单元的状态:active 、inactive 、activing 、deactiving ,分别表示正在运行 、已经停止运行 、正在启动 、正在停止
[root@localhost ~]$ systemctl list-units # 列出正在运行的unit
[root@localhost ~]$ systemctl list-units --all # 列出所有状态的unit
[root@localhost ~]$ systemctl list-units --all --state=active # 列出指定状态的unit
[root@localhost ~]$ systemctl list-units --type=service # 列出指定类型的unit
三、CentOS7 target 介绍
(1) target 其实就是一组 unit 组合,CentOS7 的 target 相当于 CentOS6 的 runlevel ( 运行级别 ) ,启动一个 target,就相当于启动多个 unit
(2) 一个 service 属于一种类型的 unit ,多个 unit 可以组成一个 target ,一个 target 包含了多个 service
[root@localhost ~]$ ll /usr/lib/systemd/system/
lrwxrwxrwx. 1 root root 15 1月 15 10:39 runlevel0.target -> poweroff.target
lrwxrwxrwx. 1 root root 13 1月 15 10:39 runlevel1.target -> rescue.target
lrwxrwxrwx. 1 root root 17 1月 15 10:39 runlevel2.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 1月 15 10:39 runlevel3.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 1月 15 10:39 runlevel4.target -> multi-user.target
lrwxrwxrwx. 1 root root 16 1月 15 10:39 runlevel5.target -> graphical.target
lrwxrwxrwx. 1 root root 13 1月 15 10:39 runlevel6.target -> reboot.target
[root@localhost ~]$ systemctl get-default # 查看当前系统默认的target
[root@localhost ~]$ systemctl list-unit-files --type=target # 列出所有target
[root@localhost ~]$ systemctl list-dependencies multi-user.target # 查看指定target下有哪些unit
管理开机启动:systemd的更多相关文章
- centos7 管理开机启动:systemd
一.CentOS7 systemd 介绍 在 CentOS7 中,使用 systemd 来管理其他服务是否开机启动,systemctl 是 systemd 服务的命令行工具 [root@mysql ~ ...
- 管理开机启动:chkconfig
CentOS 6 如何设置服务开机启动: [root@localhost ~]$ ls /etc/init.d/httpd # /etc/init.d/目录下必须有启动脚本 [root@localho ...
- Ubuntu管理开机启动服务项 -- 图形界面的Boot-up Manager
有时学习时安装的服务太多,比如mysql.mongodb.redis.apache.nginx等等,它们都是默认开机启动的,如果不想让它们开机启动,用到时再自己手工启动怎么办呢? 使用sysv-rc- ...
- 【系统自启动】使用windows自带工具管理开机启动项
1.windows+R,键入:msconfig 2.进入启动选项卡 3.将不用自启动的选项 取消勾选即可 点击应用,重启电脑即可
- [Ubuntu]管理开机启动项的软件
sudo apt-get install sysv-rc-conf
- CentOS7开机启动管理systemd简介及使用
systemd提供更优秀的框架以表示系统服务间的依赖关系实现系统初始化时服务的并行启动,同时达到降低Shell的系统开销的效果systemd的目标是:尽可能启动更少进程:尽可能将更多进程并行启动.sy ...
- (十八)Linux开机启动管理---systemd使用
常用命令 使某服务自动启动 systemctl enable httpd.service 使某服务不自动启动 systemctl disable httpd.service 检查服务状态 system ...
- 【转】Linux开机启动管理---systemd使用
常用命令 使某服务自动启动 systemctl enable httpd.service 使某服务不自动启动 systemctl disable httpd.service 检查服务状态 syste ...
- CentOS 7 设置自定义开机启动,添加自定义系统服务
详细文档,http://www.linuxidc.com/Linux/2015-04/115937.htm 摘自: http://www.centoscn.com/CentOS/config/2015 ...
随机推荐
- JAVA-JSP之taglib指令
相关资料:<21天学通Java Web开发>http://blog.csdn.net/dyyaries/article/details/9960987 备注:这个实例我没有跑起来,我看的是 ...
- 友盟分享和cocos2dx符合重复duplicate symbol 解决方案
最近使用友盟分享的sdk,没想到libWechatSDK.a居然和cocos2dx的符合冲突,提示base64.o重复了. 于是到网上找了一下解决方案,基本上去除微信的base64.o即可了. 用ar ...
- Winform重画ComboBox背景色
//返回hWnd参数所指定的窗口的设备环境. [System.Runtime.InteropServices.DllImport("user32.dll")] static ext ...
- git关联远程仓库命令<原>
一.存在远程仓库了,本地想克隆其代码: $ git clone git@git.oschina.net:winkey4986/Weather_demo.git 二.本地有代码了,想在建个远程仓库保存代 ...
- 一站式学习Wireshark(二):应用Wireshark观察基本网络协议
TCP: TCP/IP通过三次握手建立一个连接.这一过程中的三种报文是:SYN,SYN/ACK,ACK. 第一步是找到PC发送到网络服务器的第一个SYN报文,这标识了TCP三次握手的开始. 如果你找不 ...
- eclipse安装中文补丁包
第一步:打开http://www.eclipse.org/babel/ 第二步:找到downloads. 第三步:点击Oxygen. 第四步:找到简体中文的zip插件并兵下载. 第五步:解压. 第六步 ...
- 【安装Python环境】之安装Selenium2时报UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc8 in position 12: invalid continuation byte问题
问题描述: windows8.1系统,Python3环境安装Selenium2时报错,错误如下: ..... ..... File "F:\软件\python3.6.1\lib\site-p ...
- 简单又好用的聊天室技术——WebSocket
现在,很多网站为了实现推送技术,所用的技术都是轮询.轮询是在特定的的时间间隔(如每1秒),由浏览器对服务器发出HTTP request,然后由服务器返回最新的数据给客户端的浏览器.这种传统的模式带来很 ...
- 判断list为空的条件
if(list!=null&&!list.isEmpty()){ hql.append(" and (status = ? or sta ...
- Android修改默认SharedPreferences文件的路径,SharedPreferences常用工具类
import android.app.Activity; import android.content.Context; import android.content.ContextWrapper; ...