From 94bd4edef9c4458d8197c670e4a30c56e32a32ad Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Mon, 5 Nov 2012 13:16:45 +0000 Subject: [PATCH] Prefer the use of pgrep instead of ps | grep for exactly the reason specified in the handbook: ps is "racy". Approved by: jkois --- .../books/handbook/basics/chapter.xml | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/en_US.ISO8859-1/books/handbook/basics/chapter.xml b/en_US.ISO8859-1/books/handbook/basics/chapter.xml index 36150841e4..fa7f3d706b 100644 --- a/en_US.ISO8859-1/books/handbook/basics/chapter.xml +++ b/en_US.ISO8859-1/books/handbook/basics/chapter.xml @@ -2185,20 +2185,12 @@ Swap: 256M Total, 38M Used, 217M Free, 15% Inuse Find the process ID of the process you want to send the - signal to. Do this using &man.ps.1; and &man.grep.1;. The - &man.grep.1; command is used to search through output, - looking for the string you specify. This command is run as - a normal user, and &man.inetd.8; is run as - root, so the - options must be given to &man.ps.1;. + signal to. Do this using &man.pgrep.1;. - &prompt.user; ps -ax | grep inetd - 198 ?? IWs 0:00.00 inetd -wW + &prompt.user; pgrep -l inetd +198 inetd -wW - So the &man.inetd.8; PID is 198. In some cases the - grep inetd command might also appear in - this output. This is because of the way &man.ps.1; has to - find the list of running processes. + So the &man.inetd.8; PID is 198.