考慮:
$ 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
該進程是由暴發戶控制的服務。
為什麼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