Prefer the use of pgrep instead of ps | grep for exactly the reason

specified in the handbook: ps is "racy".

Approved by:	jkois
This commit is contained in:
Eitan Adler 2012-11-05 13:16:45 +00:00
parent 54b1e38330
commit 94bd4edef9
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=39947

View file

@ -2185,20 +2185,12 @@ Swap: 256M Total, 38M Used, 217M Free, 15% Inuse
<step>
<para>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
<username>root</username>, so the <option>ax</option>
options must be given to &man.ps.1;.</para>
signal to. Do this using &man.pgrep.1;.</para>
<screen>&prompt.user; <userinput>ps -ax | grep inetd</userinput>
198 ?? IWs 0:00.00 inetd -wW</screen>
<screen>&prompt.user; <userinput>pgrep -l inetd</userinput>
198 inetd -wW</screen>
<para>So the &man.inetd.8; PID is 198. In some cases the
<literal>grep inetd</literal> command might also appear in
this output. This is because of the way &man.ps.1; has to
find the list of running processes.</para>
<para>So the &man.inetd.8; PID is 198.</para>
</step>
<step>