systemctl -- 系统服务管理器 【转】
systemctl -- 系统服务管理器
直接运行命令可以列出所有正在运行的服务,输出列表具有更详细的信息,比如:
[root@beyes command]# systemctl
... ...
sendmail.service loaded active exited LSB: start and stop sendmail
sshd.service loaded active running LSB: Start up the OpenSSH server daemon
udev.service loaded active running udev Kernel Device Manager
... ...
这里,还有一个 systemd-cgls 命令可以以树状的形式列出正在运行的进程信息。
如果要启动 httpd 服务,那么运行下面命令:
[root@beyes command]# systemctl start httpd.service
注意,上面的 httpd 后面的 .service 是不能少的。
同理,停止服务和重启服务可以分别如下运行命令:
# systemctl stop httpd.service #停止服务
# systemctl restart httpd.service #重启服务
如果我们要查看服务的运行状态,那么如下运行:
[root@beyes command]# systemctl status httpd.service
httpd.service - LSB: start and stop Apache HTTP Server
Loaded: loaded (/etc/rc.d/init.d/httpd)
Active: active (running) since Wed, 22 Feb 2012 10:37:30 +0800; 2s ago
Process: 2573 ExecStop=/etc/rc.d/init.d/httpd stop (code=exited, status=0/SUCCESS)
Process: 2589 ExecStart=/etc/rc.d/init.d/httpd start (code=exited, status=0/SUCCESS)
Main PID: 2594 (httpd)
CGroup: name=systemd:/system/httpd.service
├ 2594 /usr/sbin/httpd
├ 2596 /usr/sbin/httpd
├ 2597 /usr/sbin/httpd
├ 2598 /usr/sbin/httpd
├ 2599 /usr/sbin/httpd
├ 2600 /usr/sbin/httpd
├ 2601 /usr/sbin/httpd
├ 2602 /usr/sbin/httpd
└ 2603 /usr/sbin/httpd
如果我们打算让服务可以随机启动,那么如下运行:
[root@beyes command]# systemctl enable httpd.service
httpd.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig httpd on
用 chkconfig 命令检测一下服务是否运行成功
[root@beyes command]# chkconfig --list |grep httpdNote: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
可见服务已经在 第2 到 第5 运行等级打开。
同理禁止服务随机启动可以如下运行:
[root@beyes command]# systemctl disable httpd.service
httpd.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig httpd off
用 chkconfig 检测一下:
[root@beyes command]# chkconfig --list |grep httpdNote: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
已经关闭成功。
此外,我们还可以直接检测服务是否随机启动或否,如下运行命令:
[root@beyes command]# systemctl is-enabled httpd.service; echo $?
httpd.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig httpd --level=5
0
上面,0 表示该服务已经使能随机启动;如果返回 1 那么表示该服务不随机启动
ref:http://www.groad.net/bbs/simple/?t6224.html
systemctl -- 系统服务管理器 【转】的更多相关文章
- Atitit.木马病毒的操作注册表原理 系统服务管理器 atiSysService
Atitit.木马病毒的操作注册表原理 系统服务管理器 atiSysService 1. atiSysService1 2. atiSysService 原理1 3. Java code1 4. 参 ...
- Atitit.跨语言系统服务管理器api兼容设计
Atitit.跨语言系统服务管理器api兼容设计 1. Common api,兼容sc ,service control??1 1.1. 服务创建,use sc1 1.2. 服务delete ,use ...
- systemctl命令是系统服务管理器指令,它实际上将 service 和 chkconfig 这两个命令组合到一起。
1.centos 检查服务是否开机自启 (ntpd是原生的服务,mysql是注册的服务) 参考:1.http://man.linuxde.net/systemctl
- Linux - 利用systemctl命令管理服务
systemctl命令是系统服务管理器指令,融合了service和chkconfig的功能,可以查看和设置服务. 这里以docker服务为例. 利用systemctl命令管理 显示服务状态:syste ...
- Android提供的系统服务之--TelephonyManager(电话管理器)
Android提供的系统服务之--TelephonyManager(电话管理器) 转载请注明出处--coder-pig TelephonyManager的作用: 用于管理手机通话状态,获取电话信息(设 ...
- CentOS7系统服务管理systemctl
目录 一.systemctl介绍 二.systemctl常用命令 1.启动服务 2.停止服务 3.重启服务 4.查看服务是否已启动 5.查看服务的状态 6.启用开机自启动服务 7.停用开机自启动服务 ...
- centos7系统服务管理
systemd是RH7系列操作系统开始启用新的系统和服务管理器.它被设计为与sysv init脚本向后兼容,并提供了一些功能,例如在引导时并行启动系统服务,按需激活守护程序或基于依赖关系的服务控制逻辑 ...
- “连接配置中心失败,将无法进行正常管理”--腾讯通RTX管理器
[故障现象]: 腾讯通RTX管理器提示“连接配置中心失败,将无法进行正常管理” [解决办法]: 在系统服务中启动“RTX_ConfigCenter”服务即可. 文章收集自网络
- Windows Server 2012 R2 服务器管理器介绍和配置使用
1. 服务管理器是用于管理系统服务的管理工具.一般常用于windows系统,使用这个工具你可以启动.停止服务:设置服务是自动.手动启动或禁用:查看某个服务的相关信息:设置服务以什么用户启动等等(一般包 ...
随机推荐
- Django之模板基础
Django之模板 目录 变量 过滤器 标签的使用 变量 变量的引用格式 使用双括号,两边空格不能省略. 语法格式: {{var_name}} Template和Context对象 context 字 ...
- tensorflow下基于DNN实现实时分辨人脸微表情
参加学校的国创比赛的时候,我们小组的项目有一部分内容需要用到利用摄像头实现实时检测人脸的表情,因为最近都在看深度学习方面的相关知识,所以就自己动手实现了一下这个小Demo.参考网上的资料,发现大部分是 ...
- jquery,underscore,lodash那些事儿
一.参考链接 https://jquery.com/ https://en.wikipedia.org/wiki/JQuery https://developer.mozilla.org/zh-CN/ ...
- webstorm过期最新激活方法
打开webstorm 注册时,在打开的License Activation窗口中选择“License server”,在输入框输入下面的网址:http://idea.iteblog.com/key.p ...
- 匪警请拨110——C++
问题描述 匪警请拨110,即使手机欠费也可拨通! 为了保障社会秩序,保护人民群众生命财产安全,警察叔叔需要与罪犯斗智斗勇,因而需要经常性地进行体力训练和智力训练! 某批警察叔叔正在进行智力训练: 1 ...
- Java代码优化小结(二)
(21)将常量声明为static final,并以大写命名 这样在编译期间就可以把这些内容放入常量池中,避免运行期间计算生成常量的值.另外,将常量的名字以大写命名也可以方便区分出常量与变量 (22)不 ...
- 2018 完美搭建VS Code 的JAVA开发环境并解决print乱码问题
出自微软的Visual Studio Code 并不是一个 IDE,它是个有理想,有前途的编辑器,通过相应语言的插件,可以将其包装成一个 轻量级的功能完善的IDE. 自从遇见了她,真的是对她一见钟情不 ...
- iOS自动布局的学习
Autolayout: 最重要的两个概念: 约束:对控件位置和大小的限定条件 参照:对控件设置的约束是相对于哪一个视图而言的 自动布局的核心计算公式: obj1.property1 =(obj2.pr ...
- NodeJS 连接接MySQL
NodeJS 连接接MySQL MySQL是常用数据库,作为后端模块,nodejs可以提供了mysql接口 安装 $ npm install mysql 测试代码 var mysql = requir ...
- 大数据hadoop生态圈
大数据本身是个很宽泛的概念,Hadoop生态圈(或者泛生态圈)基本上都是为了处理超过单机尺度的数据处理而诞生的.你可以把它比作一个厨房所以需要的各种工具.锅碗瓢盆,各有各的用处,互相之间又有重合.你可 ...