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:
parent
54b1e38330
commit
94bd4edef9
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/head/; revision=39947
1 changed files with 4 additions and 12 deletions
|
@ -2185,20 +2185,12 @@ Swap: 256M Total, 38M Used, 217M Free, 15% Inuse
|
||||||
|
|
||||||
<step>
|
<step>
|
||||||
<para>Find the process ID of the process you want to send the
|
<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
|
signal to. Do this using &man.pgrep.1;.</para>
|
||||||
&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>
|
|
||||||
|
|
||||||
<screen>&prompt.user; <userinput>ps -ax | grep inetd</userinput>
|
<screen>&prompt.user; <userinput>pgrep -l inetd</userinput>
|
||||||
198 ?? IWs 0:00.00 inetd -wW</screen>
|
198 inetd -wW</screen>
|
||||||
|
|
||||||
<para>So the &man.inetd.8; PID is 198. In some cases the
|
<para>So the &man.inetd.8; PID is 198.</para>
|
||||||
<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>
|
|
||||||
</step>
|
</step>
|
||||||
|
|
||||||
<step>
|
<step>
|
||||||
|
|
Loading…
Reference in a new issue