码迷,mamicode.com
首页 > 系统相关 > 详细

查看终端进程是否死掉技巧

时间:2016-02-22 16:10:10      阅读:279      评论:0      收藏:0      [点我收藏+]

标签:linux

有时候我们打开某个终端执行命令会出现以下情况,比如源码装wdcp:


installing mysql,this may take a few minutes,hold on plz...

configure in progress ...

make in progress ...


  0$ lanmp*                                          (leinterest/1.16 1.22 1.09)


这个界面停了很久,而我们不知道它是否有在运行,此时可以这样:

[root@leinterest ~]# w

 11:37:39 up  1:43,  2 users,  load average: 1.29, 1.17, 1.02

USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT

root     pts/1   x.x.x.x:S. 10:38   55:04   6.16s  0.00s /bin/bash

root     pts/2    x.x.x.x    11:33    0.00s  0.15s  0.02s w


查找到对应终端的tty,然后:

[root@leinterest ~]# watch ‘ps aux|grep pts/1‘


Every 2.0s: ps aux|grep pts/1                                                                                                                                                     Mon Feb 22 11:45:22 2016


root  6482  0.0  0.3 108304  1884 pts/1    Ss   10:38   0:00 /bin/bash

root  6495  0.0  0.1 108304   700 pts/1    S+   10:38   0:00 /bin/bash

root  6496  0.0  0.3 106332  1748 pts/1    S+   10:38   0:00 /bin/bash ./lanmp.sh

root  6497  0.0  0.1 100912   660 pts/1    S+   10:38   0:00 tee lanmp_ins.log

root     11114  0.0  0.1 106064   680 pts/1    S+   11:43   0:00 /bin/sh -c failcom=‘exit 1‘; \?for f in x $MAKEFLAGS; do \?  case $f in \?    *=* | --[!k]*);; \?    *k*) failcom=‘fail=yes‘;; \?  esac;

root     11115  0.0  0.2 101472  1452 pts/1    S+   11:43   0:00 make all

root     11171  0.0  0.2 101576  1476 pts/1    S+   11:43   0:00 make all-recursive

root     11172  0.0  0.2 106064  1384 pts/1    S+   11:43   0:00 /bin/sh -c failcom=‘exit 1‘; \?for f in x $MAKEFLAGS; do \?  case $f in \?    *=* | --[!k]*);; \?    *k*) failcom=‘fail=yes‘;; \?  esac;

root     11178  0.0  0.3 101576  1548 pts/1    S+   11:43   0:00 make all-am

root     11524  0.0  0.1 101144   880 pts/1    S+   11:44   0:00 g++ -DMYSQL_SERVER -DDEFAULT_MYSQL_HOME="/www/wdlinux/mysql-5.1.69" -DMYSQL_DATADIR="/www/wdlinux/mysql-5.1.69/var" -DSHAREDIR="/www/wdli

root     11525 90.6 25.9 242272 130292 pts/1   R+   11:44   0:29 /usr/libexec/gcc/x86_64-redhat-linux/4.4.7/cc1plus -quiet -I. -I../include -I../include -I../include -I../regex -I. -MD item.d -MF .deps/

root     11532  1.5  0.4 108208  2052 pts/2    S+   11:45   0:00 watch ps aux|grep pts/1

root     11556  0.0  0.2 106060  1280 pts/2    S+   11:45   0:00 sh -c ps aux|grep pts/1

root     11558  0.0  0.1 103308   896 pts/2    S+   11:45   0:00 grep pts/1

root     24143  0.0  0.2 101180  1076 pts/1    S+   10:48   0:00 make

root     24144  0.0  0.2 106064  1380 pts/1    S+   10:48   0:00 /bin/sh -c failcom=‘exit 1‘; \?for f in x $MAKEFLAGS; do \?  case $f in \?    *=* | --[!k]*);; \?    *k*) failcom=‘fail=yes‘;; \?  esac;


此时界面会显示pts/1所运行的进程,如果有变化则说明进程有在运行,如果长时间没变化则考虑进程是否挂掉了。


查看终端进程是否死掉技巧

标签:linux

原文地址:http://linzb.blog.51cto.com/5192423/1743909

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!