1. 问题:
在linux环境中,使用 pgrep 查询某个正在运行的进程的pid ,显示查不到,但使用pgrep -f 可以查到:
[root@host]# pgrep MCalcTaskService
[root@host]# pgrep -f MCalcTaskService
5137
在终端上查pgrep 的使用手册(命令 man pgrep),发现:pgrep默认只能匹配进程的前 15 个字符.
NOTES:
The process name used for matching is limited to the 15 characters present in the output of/proc/oid/stat. Use the -f option to match against the complete command line,/proc/pid/cmdline.
the running pgrep process will never report itself as a match.