一、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. perl模块安装——cpanm

    下载 wget  http://xrl.us/cpanm mv cpanm.1 cpanm 配置 在bashrc或zshrc里面加入下面的几句话 最好把相对路径改成绝度路径(将~换成你根目录的绝对路径 ...

  2. 一款基于jquery带百分比的响应式进度加载条

    今天要给大家带来一款基于jquery带百分比的响应式进度加载条.这款加载条非常漂亮,而且带有进度的百度比,且在不同的百分比用的是不同的颜色.而且这款加载条采用了响应式设计,在不同的分辨率的显示器下完美 ...

  3. 关于使用samba用户的权限设置

    首先要保证你的samba安装并配置好,关于安装和配置samba请参考此文章http://blog.csdn.net/linglongwunv/archive/2010/01/19/5212875.as ...

  4. 4G模块ME3760_V2的拨号过程

    AT AT+CFUN=1                          模块功能全打开,上电可以设置默认状态 AT+ZSET="LET_INFO" 掉电后可以保存AT+CFUN ...

  5. Tomcat配置 设置启动参数,点击startup.bat启动

    catalina.batrem ---------------------------------------------------------------------------rem Set J ...

  6. Android——基于监听器的事件处理(转)

    事件,我们并不陌生! 所有的基于UI的应用程序,事件都变得不可或缺!试想一下,如果我们做的程序单击按钮和其它控件都没有反应,那么就如同一个人在这个世界上听不到声音一样! Android为我们提供了两种 ...

  7. JAVA的包装类2 【转】

    怎么理解JAVA中的“包装类” JAVA是一种面向对象语言,java中的类把方法与数据连接在一起,构成了自包含式的处理单元.但在JAVA中不能定义基本类型(primitive  type)对象,为了能 ...

  8. 电快速脉冲群EFT(概念)

    电快速瞬变脉冲群 简称EFT(Electrical Fast Transient)是指脉冲群有特定的持续时间(规定为15mS),特定的脉冲周期(300mS)的脉冲, 脉冲群中的单个脉冲有特定的重复周期 ...

  9. ansible debug模块学习笔记

    - name: Print debug infomation eg hosts: test2 gather_facts: F tasks: - name: Command run line shell ...

  10. DataGridView使用技巧六:冻结列或行

    一.冻结列 DataGridViewColumn.Frozen属性为true时,该列左侧的所有列被固定,横向滚动时固定列不随滚动条滚动而左右移动.这对于重要列固定很有用. 示例:通过程序固定左侧第二列 ...