centos7当中的systemd及systemctl(节选)
全面进入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(节选)的更多相关文章
- CentOS7进程管理systemd详解
概述: 系统启动过程中,当内核启动完成,后加载根文件系统,后就绪的一些用户空间的服务的管理工作,就交由init进行启动和管理,在CentOS6之前的init的管理方式都类似,相关的内容我们在之前的 ...
- Linux centos7系统列出systemd下所有正在运行的服务
Linux系统提供各种系统服务(如进程管理.登录.syslog.cron等)和网络服务.Linux支持不同的方法来管理服务(启动.停止.重启.在系统启动时的自动启动等),通常通过流程或服务管理器. 大 ...
- Linux CentOS7.0 (04)systemctl vs chkconfig、service
CentOS 7.0中已经没有service命令,而是启用了systemctl服务器命令 systemctl 是系统服务管理器命令,它实际上将 service 和 chkconfig 这两个命令组合到 ...
- centos7 将服务添加到systemctl
centos7中提供了systemd服务,可以方便的管理各种服务 但是有些通过编译安装的服务systemd里面没有,我们只需要添加一下服务文件即可 以下用nginx作为例子,展示如何添加服务到syst ...
- centos7中设置nginx的systemctl启动方式
1.建立服务文件 (1)文件路径 vim /usr/lib/systemd/system/nginx.service (2)服务文件内容 [Unit] Description=nginx - high ...
- systemd 之 systemctl
Systemd 常规操作与彩蛋 一.前言 上了俩个月的RHCE工程师的班,收获颇多.话说回来,在 redhat 7 中有个非常重要的概念,即:systemd systemd 是 Linux 下的一款系 ...
- Centos7 服务 service 设置命令 systemctl 用法 (替代service 和 chkconfig)
在Centos 中 systemctl 是设置系统服务的命令,即 service , 它融合之前service和chkconfig的功能于一体. 可以使用它永久性或只在当前会话中启用/禁用服务 ...
- CentOS 7上的系统管理之:Systemd和systemctl
参考资料: Chapter 10. Managing Services with systemd Red Hat Enterprise Linux 7 | Red Hat Customer Porta ...
- CentOS7下普通账号通过systemctl管理服务需要输入root密码问题
问题描述: 使用普通账号test通过systemctl启动系统服务提示需要输入root密码: 解决方案: 根据上面提示得知权限由polkit进行管理,对应的是org.freedesktop.syste ...
随机推荐
- DataGridView过滤功能
http://www.codeproject.com/Articles/33786/DataGridView-Filter-Popup http://www.cnblogs.com/jaxu/arch ...
- Spark+Python+Pycharm在Windows下的配置
http://blog.csdn.net/ydq1206/article/details/51922148
- 纯Div+Css制作的漂亮点击按钮和关闭按钮
纯Div+Css制作的漂亮点击按钮和关闭按钮,单击点击按钮也有效果.这些都不是图片.
- SetLocalTime设置本地时间
/***************************************************************** 函数名:EnableSetTimePriviledge 功 能:开 ...
- BZOJ 2500 幸福的道路(race) 树上直径+平衡树
structHeal { priority_queue<int> real; priority_queue<int> stack; void push(int x){ real ...
- POJ3189:Steady Cow Assignment(二分+二分图多重匹配)
Steady Cow Assignment Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7482 Accepted: ...
- tomcat 配置文件中设置JAVA_HOME
Tomcat默认情况下会用系统的环境变量中找到JAVA_HOME和JRE_HOME.但是有的时候我们需要不同版本的JDK共存. 可以在${TOMCAT_HOME}/bin/setclasspath.b ...
- Ubuntu 编译Webkit --gtk
转载自:http://www.linuxidc.com/Linux/2011-10/44809.htm webkit是一个浏览器内核,google的chrome就是基于它的,下面介绍一下如何在Ubun ...
- 数据结构之DFS与BFS
深度搜索(DFS) and 广度搜索(BFS) 代码如下: #include "stdafx.h" #include<iostream> #include<st ...
- JavaScript中cookie使用
转自:http://www.cnblogs.com/yjzhu/archive/2012/11/26/2789032.html 一.什么是 cookie? cookie 就是页面用来保存信息,比如自动 ...