全面进入centos7时代,这个东东是需要系统了解的。

http://blog.jobbole.com/85070/?utm_source=blog.jobbole.com&utm_medium=relatedPosts

========================

系统管理员

systemd 的主要命令行工具是 systemctl。

多数管理员应该都已经非常熟悉系统服务和 init 系统的管理,比如 service、chkconfig 以及 telinit 命令的使用。systemd 也完成同样的管理任务,只是命令工具 systemctl 的语法有所不同而已,因此用表格来对比 systemctl 和传统的系统管理命令会非常清晰。

表 2. Systemd 命令和 sysvinit 命令的对照表
Sysvinit 命令 Systemd 命令 备注
service foo start systemctl start foo.service 用来启动一个服务 (并不会重启现有的)
service foo stop systemctl stop foo.service 用来停止一个服务 (并不会重启现有的)。
service foo restart systemctl restart foo.service 用来停止并启动一个服务。
service foo reload systemctl reload foo.service 当支持时,重新装载配置文件而不中断等待操作。
service foo condrestart systemctl condrestart foo.service 如果服务正在运行那么重启它。
service foo status systemctl status foo.service 汇报服务是否正在运行。
ls /etc/rc.d/init.d/ systemctl list-unit-files –type=service 用来列出可以启动或停止的服务列表。
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 输出在各个运行级别下服务的启用和禁用情况
chkconfig foo –list ls /etc/systemd/system/*.wants/foo.service 用来列出该服务在哪些运行级别下启用和禁用。
chkconfig foo –add systemctl daemon-reload 当您创建新服务文件或者变更设置时使用。
telinit 3 systemctl isolate multi-user.target (OR systemctl isolate runlevel3.target OR telinit 3) 改变至多用户运行级别。

除了表 2 列出的常见用法,系统管理员还需要了解其他一些系统配置和管理任务的改变。

首先我们了解 systemd 如何处理电源管理,命令如下表所示:

表 3,systemd 电源管理命令
命令 操作
systemctl reboot 重启机器
systemctl poweroff 关机
systemctl suspend 待机
systemctl hibernate 休眠
systemctl hybrid-sleep 混合休眠模式(同时休眠到硬盘并待机)

关机不是每个登录用户在任何情况下都可以执行的,一般只有管理员才可以关机。正常情况下系统不应该允许 SSH 远程登录的用户执行关机命令。否则其他用户正在工作,一个用户把系统关了就不好了。为了解决这个问题,传统的 Linux 系统使用 ConsoleKit 跟踪用户登录情况,并决定是否赋予其关机的权限。现在 ConsoleKit 已经被 systemd 的 logind 所替代。

centos7当中的systemd及systemctl(节选)的更多相关文章

  1. CentOS7进程管理systemd详解

      概述: 系统启动过程中,当内核启动完成,后加载根文件系统,后就绪的一些用户空间的服务的管理工作,就交由init进行启动和管理,在CentOS6之前的init的管理方式都类似,相关的内容我们在之前的 ...

  2. Linux centos7系统列出systemd下所有正在运行的服务

    Linux系统提供各种系统服务(如进程管理.登录.syslog.cron等)和网络服务.Linux支持不同的方法来管理服务(启动.停止.重启.在系统启动时的自动启动等),通常通过流程或服务管理器. 大 ...

  3. Linux CentOS7.0 (04)systemctl vs chkconfig、service

    CentOS 7.0中已经没有service命令,而是启用了systemctl服务器命令 systemctl 是系统服务管理器命令,它实际上将 service 和 chkconfig 这两个命令组合到 ...

  4. centos7 将服务添加到systemctl

    centos7中提供了systemd服务,可以方便的管理各种服务 但是有些通过编译安装的服务systemd里面没有,我们只需要添加一下服务文件即可 以下用nginx作为例子,展示如何添加服务到syst ...

  5. centos7中设置nginx的systemctl启动方式

    1.建立服务文件 (1)文件路径 vim /usr/lib/systemd/system/nginx.service (2)服务文件内容 [Unit] Description=nginx - high ...

  6. systemd 之 systemctl

    Systemd 常规操作与彩蛋 一.前言 上了俩个月的RHCE工程师的班,收获颇多.话说回来,在 redhat 7 中有个非常重要的概念,即:systemd systemd 是 Linux 下的一款系 ...

  7. Centos7 服务 service 设置命令 systemctl 用法 (替代service 和 chkconfig)

    在Centos 中 systemctl  是设置系统服务的命令,即 service  ,   它融合之前service和chkconfig的功能于一体. 可以使用它永久性或只在当前会话中启用/禁用服务 ...

  8. CentOS 7上的系统管理之:Systemd和systemctl

    参考资料: Chapter 10. Managing Services with systemd Red Hat Enterprise Linux 7 | Red Hat Customer Porta ...

  9. CentOS7下普通账号通过systemctl管理服务需要输入root密码问题

    问题描述: 使用普通账号test通过systemctl启动系统服务提示需要输入root密码: 解决方案: 根据上面提示得知权限由polkit进行管理,对应的是org.freedesktop.syste ...

随机推荐

  1. WebStorm中配置ExtJS

    原文链接:http://zhidao.baidu.com/link?url=yX0wDWrL-b2P8k3JNNI38Fb6keuAgm0j9E-QBL1KfWXrZgLZ88grAOVJvat6dJ ...

  2. Good Time 冲刺 三

    第三天 日期:2018.6.16 一.今日完成任务情况及遇到的问题 王怡镔:继续在学习微信小程序的设计,完善设计发现页面,开始编写发现页面 于鑫宇:配合黄鹤的工作,学习端口相关知 胡雅馨:继续改进优化 ...

  3. stap用法

    sudo stap -g submit_bio.stp -D MAXACTION=100000 kern_path_locked lookup_one_len filename_create --&g ...

  4. 算法(13)Contiguous Array

    题目:找出数组的一个子数组,要求这个子数组中0和1的数量相等,找出最大长度的这样的数组! 思路:也是受网上算法的启发吧,用一个 语言:如何初始化一个unordered_map<int,int&g ...

  5. 将CRUD封装到一个工具类中

    package org.zln.hibernate.utils; import org.hibernate.Session; import org.hibernate.SessionFactory; ...

  6. javascript中window.location.search方法简介

    window.location.search方法是截取当前url中"?"后面的字符串,示例如下: 例如:http://www.firefoxchina.cn/?ntab截取后的字符 ...

  7. 洛谷 P1607 [USACO09FEB]庙会班车Fair Shuttle 解题报告

    P1607 [USACO09FEB]庙会班车Fair Shuttle 题目描述 Although Farmer John has no problems walking around the fair ...

  8. gitlab7.2安装

    系统:centos6.4 1.安装依赖包 导入epel: useradd git wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-rel ...

  9. git学习,哇瑟说实话我想要的

    1.Git 简介及安装Git是目前世界上最先进的分布式版本控制系统(没有之一).它的诞生也颇具传奇,Linux创始人Linus花了两周时间自己用C写了一个分布式版本控制系统,这就是Git!有兴趣的话, ...

  10. Spring学习-- Bean 的作用域

    Bean 的作用域: 在 Spring 中 , 可以在 <bean> 元素的 scope 属性里设置 bean 的作用域. 默认情况下 , Spring 只为每个在 IOC 容器里声明的 ...