在linux下我们一般是需要了解我们的进程的状态的.
我们以mysql为例

service mysqld status

[root@VM_57_70_centos ~]# service mysqld status;
mysqld (pid  17239) is running...
[root@VM_57_70_centos ~]# 

我这里是启动状态,可以看见pid

chkconfig –list +你的服务

[root@VM_57_70_centos ~]# chkconfig --list mysqld;
mysqld         	0:off	1:off	2:on	3:on	4:on	5:on	6:off
[root@VM_57_70_centos ~]# 

可以看见是启动的,有on状态

pidof +你的服务

[root@VM_57_70_centos ~]# pidof mysqld
17239
[root@VM_57_70_centos ~]# 

可以看见pid,说明,此时,mysql服务正在运行,如果没有运行的话,是没有输出的

ps -ef | grep +你的服务

这里写图片描述

可以通过netstat -tanp查看

这里写图片描述

如果有的话,上面也是会有mysql这一条的

好了,上面简单介绍了几种常用的方式来查看进程,选择一种你喜欢的就好

版权声明:本文为liuge36原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/liuge36/p/9882973.html