Added patch from Walter Harms which allows pidof to run without

displaying output. In this mode pidof simply returns true or false
without displaying PID values.

Updated manual page with new -q (quiet) mode.

Added -h flag for pidof, which was recognized before, but not used.
The -h flag now displays brief usage information for pidof.
This commit is contained in:
Jesse Smith
2018-09-08 17:19:21 -03:00
parent eda1f0d6ba
commit f1ca96e1c1
2 changed files with 38 additions and 7 deletions

View File

@@ -32,7 +32,7 @@ pidof -- find the process ID of a running program.
.RB [ program.. ]
.SH DESCRIPTION
.B Pidof
finds the process id's (pids) of the named programs. It prints those
finds the process id's (PIDs) of the named programs. It prints those
id's on the standard output. This program is on some systems used in
run-level change scripts, especially when the system has a
\fISystem-V\fP like \fIrc\fP structure. In that case these scripts are
@@ -44,7 +44,7 @@ a
.IP \-s
Single shot - this instructs the program to only return one \fIpid\fP.
.IP \-c
Only return process ids that are running with the same root directory.
Only return process PIDs that are running with the same root directory.
This option is ignored for non-root users, as they will be unable to check
the current root directory of processes they do not own.
.IP \-n
@@ -56,6 +56,9 @@ based file systems like
Instead of using this option the the variable
.B PIDOF_NETFS
may be set and exported.
.IP \-q
Do not display matched PIDs to standard out. Simply exit with
a status of true or false to indicate whether a matching PID was found.
.IP \-x
Scripts too - this causes the program to also return process id's of
shells running the named scripts.
@@ -76,7 +79,7 @@ the program behaves according to the name under which it is called.
.PP
When \fIpidof\fP is invoked with a full pathname to the program it
should find the pid of, it is reasonably safe. Otherwise it is possible
that it returns pids of running programs that happen to have the same name
that it returns PIDs of running programs that happen to have the same name
as the program you're after but are actually other programs. Note that
that the executable name of running processes is calculated with
.BR readlink (2),