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系统,使用这个工具你可以启动.停止服务:设置服务是自动.手动启动或禁用:查看某个服务的相关信息:设置服务以什么用户启动等等(一般包 ...
随机推荐
- execution(* com.sample.service.impl..*.*(..))
execution(* com.sample.service.impl..*.*(..)) 解释如下: 符号 含义 execution() 表达式的主体: 第一个”*“符号 表示返回值的类型任意: c ...
- 初窥Java之三
一.基本数据类型之浮点型 每个数据它自身都有一个默认的类型,如果直接打印小数,默认类型就为double类型: float和double表示小数的精度不是特别的高,如果对于精确度要求非常的高,我们 都使 ...
- vue的中vuex为何需要mutation更新状态,vue-router的路由的理解
); ); ); history.back(); history.forward(); // 修改历史,包括二个方法pushState.replaceState二个方法(objState,title, ...
- ZOJ 1610 Count the Colors 【线段树】
<题目链接> 题目大意: 在[0,8000]这个区间内,不断进行一些操作,将其中的一些区间染成特定颜色,如果区间重复的话,后面染的色块会覆盖前面染的色块,问最终[0,8000]这个区间内每 ...
- P3150 pb的游戏(1)
P3150 pb的游戏(1)选偶数,这一轮一定会活,选奇数,自己这一轮可能会死,并且(如果自己这一轮没死)下一轮对手一定可以活,因为选了奇数,就会被分解成奇数和偶数. #include<iost ...
- 李宏毅机器学习笔记4:Brief Introduction of Deep Learning、Backpropagation(后向传播算法)
李宏毅老师的机器学习课程和吴恩达老师的机器学习课程都是都是ML和DL非常好的入门资料,在YouTube.网易云课堂.B站都能观看到相应的课程视频,接下来这一系列的博客我都将记录老师上课的笔记以及自己对 ...
- Python Pexpect库的简单使用
Python Pexpect库的使用 简介 最近需要远程操作一个服务器并执行该服务器上的一个python脚本,查到可以使用Pexpect这个库.记录一下. 什么是Pexpect?Pexpect能够产生 ...
- Java内存管理-Stackoverflow问答-Java是传值还是传引用?(十一)
勿在流沙筑高台,出来混迟早要还的. 做一个积极的人 编码.改bug.提升自己 我有一个乐园,面向编程,春暖花开! 本文导图: 一.由一个提问引发的思考 在Stack Overflow 看到这样一个问题 ...
- 关于腾讯云服务器不能用公网ip访问的解决方案
最近在腾讯云服务器上部署Javaweb项目,开始外网ip是可以访问到云服务器上的项目的,我重启了一下Tomcat之后发现端口号8080无法使用,此时的公网ip还是可以使用的,然后我重启了一下云服务器之 ...
- 你真的了解META-INF吗?
你真的了解META-INF吗? 做过JAVA EE开发的工程师应该都知道在JAVA build出来的JAR或者WAR的顶层目录下有个META-INF文件夹吧,可是有多少人能够清楚说出这个文件夹到底是做 ...