一、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的更多相关文章

  1. centos7 管理开机启动:systemd

    一.CentOS7 systemd 介绍 在 CentOS7 中,使用 systemd 来管理其他服务是否开机启动,systemctl 是 systemd 服务的命令行工具 [root@mysql ~ ...

  2. 管理开机启动:chkconfig

    CentOS 6 如何设置服务开机启动: [root@localhost ~]$ ls /etc/init.d/httpd # /etc/init.d/目录下必须有启动脚本 [root@localho ...

  3. Ubuntu管理开机启动服务项 -- 图形界面的Boot-up Manager

    有时学习时安装的服务太多,比如mysql.mongodb.redis.apache.nginx等等,它们都是默认开机启动的,如果不想让它们开机启动,用到时再自己手工启动怎么办呢? 使用sysv-rc- ...

  4. 【系统自启动】使用windows自带工具管理开机启动项

    1.windows+R,键入:msconfig 2.进入启动选项卡 3.将不用自启动的选项 取消勾选即可 点击应用,重启电脑即可

  5. [Ubuntu]管理开机启动项的软件

    sudo apt-get install sysv-rc-conf

  6. CentOS7开机启动管理systemd简介及使用

    systemd提供更优秀的框架以表示系统服务间的依赖关系实现系统初始化时服务的并行启动,同时达到降低Shell的系统开销的效果systemd的目标是:尽可能启动更少进程:尽可能将更多进程并行启动.sy ...

  7. (十八)Linux开机启动管理---systemd使用

    常用命令 使某服务自动启动 systemctl enable httpd.service 使某服务不自动启动 systemctl disable httpd.service 检查服务状态 system ...

  8. 【转】Linux开机启动管理---systemd使用

    常用命令  使某服务自动启动 systemctl enable httpd.service 使某服务不自动启动 systemctl disable httpd.service 检查服务状态 syste ...

  9. CentOS 7 设置自定义开机启动,添加自定义系统服务

    详细文档,http://www.linuxidc.com/Linux/2015-04/115937.htm 摘自: http://www.centoscn.com/CentOS/config/2015 ...

随机推荐

  1. Linux RPM 命令参数使用详解 查看 rpm包依赖性

    转载自:http://blog.csdn.net/deutschester/article/details/6309521 rpm 执行安装包 二进制包(Binary)以及源代码包(Source)两种 ...

  2. pyQt绘图

    def paintEvent(self, e): qp = QtGui.QPainter() qp.begin(self) self.DrawChessBoard(qp) self.Draw_Ches ...

  3. 一款由css3和jquery实现的卡面折叠式菜单

    之前已经为大家介绍了好多导航菜单.今天为大家再带来一款由css3和jquery实现的卡片折叠式菜单.当菜单关闭的时候,有三维堆叠的效果.我们一起看下效果图: 在线预览   源码下载 html代码: & ...

  4. 【WPF】使用Popup控件做浮窗/提示框

    需求:当鼠标移入某个区域时,弹出一个浮窗,以便用户进行下一步操作. 效果如下图: 当鼠标移入左上角的[多选显示]框内,出现下面的浮窗(悬浮在原UI之上).当在浮窗外点击鼠标左键时,隐藏该浮窗. 由于该 ...

  5. 【高可用HA】Nginx (1) —— Mac下配置Nginx Http负载均衡(Load Balancer)之101实例

    [高可用HA]Nginx (1) -- Mac下配置Nginx Http负载均衡(Load Balancer)之101实例 nginx版本: nginx-1.9.8 参考来源: nginx.org [ ...

  6. Intellij IDEA 部署 项目在tomcat 原理

    https://www.zhihu.com/question/54757013 Intellij IDEA通过tomcat部署web项目的机制 IntelliJ IDEA通过Tomcat启动项目过程分 ...

  7. 也谈谈js的压缩,jquery压缩。【转】

    问题缘由: 负责公司的开发平台研发工作,考虑的知识产权的保护工作,必须要考虑java的加密技术和js脚本的加密技术.在目前java加密很容易破解的情况下,还是先搞定js的加密和压缩,一方面可以提高页面 ...

  8. 7 款基于 JavaScript/AJAX 的文件上传插件

    本文整理了7款基于JavaScript和AJAX的文件上传插件,这些插件基本上都能实现以下功能: 多文件上传 拖拽操作 实时上传进度 自定义上传限制 希望能为你的开发工作带来帮助. 1.  jQuer ...

  9. 【转】Mac下升级python2.7到python3.6

    1. 前言 Mac系统自带python2.7,本文目的是将自带的python升级到3.6版本. 网上有本多的做法是让python2.7和python3.X两个版本共存,博主并不知道,是两版本共存好,还 ...

  10. .net开发遇到的一个问题

    之前项目有个entity是写在Entity层的,相关的配置项也写死在程序里了,而且还是个static的配置,后来有了新需求,上峰指示要从CMS读取配置内容,大概是要在BLL实现,BLL依赖IBLL的I ...