歡迎您光臨本站 註冊首頁

shell 查看Linux 進程 是否存在

←手機掃碼閱讀     火星人 @ 2014-03-09 , reply:0
查看進程ProcessName 是否存在 存在則返回該進程的個數,不存在則返回0
ProcessName 為唯一進程名
ps -ef|grep ProcessName |grep -v "grep"|wc -l 或 pgrep -l ProcessName |wc -l
如:
[root@text index]# ps -ef | grep call.ami.php
root 29151 28812 0 10:04 pts/3 00:00:00 /usr/bin/php ./call.ami.php
root 29155 28685 0 10:04 pts/1 00:00:00 grep call.ami.php
[root@text index]# ps -ef|grep call.ami.php |grep -v "grep"|wc -l
1pgrep -l call.ami.php |wc -l 的執行結果與上面相同


[火星人 ] shell 查看Linux 進程 是否存在已經有617次圍觀

http://coctec.com/docs/linux/show-post-50892.html