考虑:
$ ps -ef | grep myprocess
root 7204 1 99 23:37 ? 00:02:36 ./myprocess
drew 7439 7266 0 23:38 pts/0 00:00:00 grep myprocess
$ pgrep myprocess
有问题的进程是一个由 upstart 控制的服务。
为啥pgrep
看不到这个过程?
答案1
我最终通过添加以下选项使它工作-f
:
-f, --full
The pattern is normally only matched against the process name. When -f is
set, the full command line is used.
其中:
$ pgrep -f myprocess
1234