CentOS/RHEL:检测各种服务(service)的启动状态
来源:互联网 发布:通过mac地址监控手机 编辑:程序博客网 时间:2024/06/05 19:43
ps aux | grep docker查看docker服务是否开启
在RHEL/Centos/Fedora Linux系统里,如何来查看某些特定的服务比如:MySQL 或者Apache是否在运行中呢?
当然你需要使用“service”命令,该命令主要用于管理Linux操作系统中各种服务,它是一个脚本命令,会调用/etc/init.d/下面的各种服务启动程序。
service SERVER status
OR
/etc/init.d/SERVER status
示例:
在Centos 或RHEL下,查看一个名为mysqld(MySQL server)的是否处于运行状态。
1
# service mysqld status
示例输出结果:
1
mysqld (pid 4324) is running...
查看所有服务的状态
命令service –status-all 将会运行所有的启动脚本来显示各个服务的运行状态:
1
#service --status-all
输出为:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
[root@osetc ~]# service --status-all
Aegis is running
auditd is stopped
crond (pid 938) is running...
ip6tables: Firewall is not running.
iptables: Firewall is not running.
ERROR! MySQL is running but PID file could not be found
netconsole module not loaded
Configured devices:
lo eth0 eth1
Currently active devices:
lo eth0 eth1
ntpd (pid 930) is running...
Usage: /etc/init.d/php-fpm {start|stop|quit|restart|reload|logrotate}
master is stopped
rdisc is stopped
rsyslogd (pid 883) is running...
sandbox is stopped
saslauthd is stopped
openssh-daemon (pid 13367) is running...
vsftpd (pid 31721) is running...
Aegis is running
auditd is stopped
crond (pid 938) is running...
ip6tables: Firewall is not running.
iptables: Firewall is not running.
ERROR! MySQL is running but PID file could not be found
netconsole module not loaded
Configured devices:
lo eth0 eth1
Currently active devices:
lo eth0 eth1
ntpd (pid 930) is running...
Usage: /etc/init.d/php-fpm {start|stop|quit|restart|reload|logrotate}
master is stopped
rdisc is stopped
rsyslogd (pid 883) is running...
sandbox is stopped
saslauthd is stopped
openssh-daemon (pid 13367) is running...
vsftpd (pid 31721) is running...
ps 和pgrep命令
你也可以执行ps或者pgrep 命令来查看服务的状态
1
2
3
4
5
6
2
3
4
5
6
#ps aux | grep 'SERVER'
#ps aux | grep 'mysqld'
#pgrep 'SERVER'
#pgrep -u username 'SERVER' ##查看某个用户的服务状态
#pgrep mysqld
#ps aux | grep 'mysqld'
#pgrep 'SERVER'
#pgrep -u username 'SERVER' ##查看某个用户的服务状态
#pgrep mysqld
启动服务:
如果Apache服务器的服务httpd没有启动,那我们如何来启动呢:
1
2
3
2
3
#service httpd status
#chkconfig httpd on
#service httpd start
#chkconfig httpd on
#service httpd start
更多信息可以参考man帮助- service, pgrep,ps
0 0
- CentOS/RHEL:检测各种服务(service)的启动状态
- CentOS/RHEL:检测各种服务(service)的启动状态
- RHEL/CentOS 6.x的系统服务
- RHEL/CentOS/Fedora各种源
- 关于nova-manage service list检测服务状态原理
- CentOS/RHEL之samba服务开启失败的问题
- CentOS 7 (RHEL 7)服务管理命令的变化
- CentOS 7 (RHEL 7)服务管理命令的变化
- Windows Service开发日志四(用程序设置服务的运行状态及启动方式)
- Android Service 手机启动服务 监听电话的状态 进行录音
- RHEL/CentOS 7.x如何启动/关闭、启用/禁用服务? 修改系统运行级别
- RHEL/CentOS 7.x如何启动/关闭、启用/禁用服务? 修改系统运行级别
- RHEL/CentOS 7.x如何启动/关闭、启用/禁用服务? 修改系统运行级别
- android 获取Service(服务)的运行状态
- RHEL的系统服务
- RHEL的服务管理
- angularjs service各种服务
- RHEL/CentOS 6.x 系统服务详解
- 1109. Group Photo (25)
- Cucumber 安装
- 1111
- VMware9 绿色破解版 下载地址
- Replace Pioneer
- CentOS/RHEL:检测各种服务(service)的启动状态
- 配置jbpm环境时,出现org.hibernate.MappingNotFoundException: resource: jbpm.repository.hbm.xml not found
- struct大小的问题
- 1112
- docker学习笔记之镜像探析
- 利用MySQL数据库如何解决大数据量存储问题?
- NDK开发学习笔记—JNI入门
- OpenCV遍历彩色图像、灰度图像的像素值方法
- leetcode_112. Path Sum 二叉树路径求和,判断是否存在路径和为某个值的路径,深度遍历,递归的return