LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   pgrep fails to find results (https://www.linuxquestions.org/questions/linux-software-2/pgrep-fails-to-find-results-4175505212/)

gosssamer 05-16-2014 08:56 AM

pgrep fails to find results
 
Hi,

Hopefully a simple question. I'm using pgrep on fedora20 and having a problem. While it finds some processes, it doesn't find others and the man page doesn't describe how the pattern matching works very well.

Code:

# ps ax|grep amavisd
10263 ?        S      0:08 /usr/sbin/amavisd (ch9-avail)
13782 ?        S      0:05 /usr/sbin/amavisd (ch7-avail)
16663 ?        Ss  160:00 /usr/sbin/amavisd (master)
19410 pts/0    S+    0:00 grep --color=auto amavisd
28089 ?        Ssl  233:28 clamd.amavisd -c /etc/clamd.d/amavisd.conf --pid /var/run/clamd.amavisd/clamd.pid
# pgrep clamd.amavisd
# pgrep amavisd
# pgrep '/usr/sbin/amavisd (master)'
# pgrep 'clamd\.amavisd'

Any ideas would be greatly appreciated.

Thanks,
Alex

AlucardZero 05-16-2014 09:19 AM

Code:

$ ps -ef | grep amavisd-new
alucard  21024 20889  0 10:17 pts/3    00:00:00 grep amavisd-new
amavis  23767    1  0 May11 ?        00:00:04 /usr/sbin/amavisd-new (master)
amavis  23769 23767  0 May11 ?        00:00:12 /usr/sbin/amavisd-new (ch18-avail)
amavis  23770 23767  0 May11 ?        00:00:03 /usr/sbin/amavisd-new (ch17-avail)
$ pgrep -u amavis -l
23767 /usr/sbin/amavi
23769 /usr/sbin/amavi
23770 /usr/sbin/amavi
$ pgrep /usr/sbin/amavi
23767
23769
23770
$ pgrep -f amavis
23767
23769
23770

Looks like the name is limited to 15 characters (??). Use -f to match the whole command line.
(I read the man page to get the idea to try -l and -f)

gosssamer 05-16-2014 10:45 AM

Quote:

Originally Posted by AlucardZero (Post 5172061)
Code:

$ ps -ef | grep amavisd-new
alucard  21024 20889  0 10:17 pts/3    00:00:00 grep amavisd-new
amavis  23767    1  0 May11 ?        00:00:04 /usr/sbin/amavisd-new (master)
amavis  23769 23767  0 May11 ?        00:00:12 /usr/sbin/amavisd-new (ch18-avail)
amavis  23770 23767  0 May11 ?        00:00:03 /usr/sbin/amavisd-new (ch17-avail)
$ pgrep -u amavis -l
23767 /usr/sbin/amavi
23769 /usr/sbin/amavi
23770 /usr/sbin/amavi
$ pgrep /usr/sbin/amavi
23767
23769
23770
$ pgrep -f amavis
23767
23769
23770

Looks like the name is limited to 15 characters (??). Use -f to match the whole command line.
(I read the man page to get the idea to try -l and -f)

Ah, thanks. There's a bug in the /usr/share/spamassassin/sa-update.cron script in fedora20. It fails to find amavisd using just "pgrep amavisd".


All times are GMT -5. The time now is 08:16 PM.