92d4b0e74a
Patch provided by Mario Blattermann. Added translation framework (po4a) from Mario Blttermann.
114 lines
4.2 KiB
Groff
114 lines
4.2 KiB
Groff
'\" -*- coding: UTF-8 -*-
|
|
.\" Copyright (C) 1998 Miquel van Smoorenburg.
|
|
.\"
|
|
.\" This program is free software; you can redistribute it and/or modify
|
|
.\" it under the terms of the GNU General Public License as published by
|
|
.\" the Free Software Foundation; either version 2 of the License, or
|
|
.\" (at your option) any later version.
|
|
.\"
|
|
.\" This program is distributed in the hope that it will be useful,
|
|
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
.\" GNU General Public License for more details.
|
|
.\"
|
|
.\" You should have received a copy of the GNU General Public License
|
|
.\" along with this program; if not, write to the Free Software
|
|
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
.\"
|
|
.TH PIDOF 8 "01 Sep 1998" "sysvinit @VERSION@" "Linux System Administrator's Manual"
|
|
.SH NAME
|
|
pidof - find the process ID of a running program
|
|
.SH SYNOPSIS
|
|
.B pidof
|
|
.RB [ \-s ]
|
|
.RB [ \-c ]
|
|
.RB [ \-n ]
|
|
.RB [ \-x ]
|
|
.RB [ \-z ]
|
|
.RB [ \-o
|
|
.IR omitpid[,omitpid...] ]
|
|
.RB [ \-o
|
|
.IR omitpid[,omitpid...]... ]
|
|
.RB [ \-d
|
|
.IR sep ]
|
|
.I program
|
|
.RI [ program... ]
|
|
.SH DESCRIPTION
|
|
.B pidof
|
|
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
|
|
located in \fI/etc/rc?.d\fP, where ? is the runlevel. If the system has
|
|
a \fBstart-stop-daemon\fP(8) program that should be used instead.
|
|
.SH OPTIONS
|
|
.IP \fB\-s\fP
|
|
Single shot - this instructs the program to only return one \fIpid\fP.
|
|
.IP \fB\-c\fP
|
|
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 \fB\-n\fP
|
|
Avoid
|
|
.BR stat (2)
|
|
system function call on all binaries which are located on network
|
|
based file systems like
|
|
.BR NFS .
|
|
Instead of using this option the variable
|
|
.B PIDOF_NETFS
|
|
may be set and exported.
|
|
.IP \fB\-q\fP
|
|
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 \fB\-x\fP
|
|
Scripts too - this causes the program to also return process id's of
|
|
shells running the named scripts.
|
|
.IP \fB\-z\fP
|
|
Try to detect processes which are stuck in zombie (Z)
|
|
status. Usually these processes are skipped as trying to deal with them can cause
|
|
pidof or related tools to hang. Note: In the past pidof would ignore processes
|
|
in the uninterruptable state (D), unless the \fB-z\fP flag was specified. This is no
|
|
longer the case. The \fBpidof\fP program will find and report processes in the D state
|
|
whether \fB-z\fP is specified or not.
|
|
.IP "-d \fIsep\fP"
|
|
Tells \fIpidof\fP to use \fIsep\fP as an output separator if more than one PID
|
|
is shown. The default separator is a space.
|
|
.IP "-o \fIomitpid\fP"
|
|
Tells \fIpidof\fP to omit processes with that process id. The special
|
|
pid \fB%PPID\fP can be used to name the parent process of the \fBpidof\fP
|
|
program, in other words the calling shell or shell script.
|
|
.SH "EXIT STATUS"
|
|
.TP
|
|
.B 0
|
|
At least one program was found with the requested name.
|
|
.TP
|
|
.B 1
|
|
No program was found with the requested name.
|
|
.SH NOTES
|
|
\fIpidof\fP is actually the same program as \fBkillall5\fP(8);
|
|
the program behaves according to the name under which it is called.
|
|
.PP
|
|
When \fBpidof\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
|
|
as the program you're after but are actually other programs. Note
|
|
that the executable name of running processes is calculated with
|
|
.BR readlink (2),
|
|
so symbolic links to executables will also match.
|
|
.PP
|
|
Zombie processes or processes in disk sleep (states Z and D, respectively)
|
|
are ignored, as attempts to access the stats of these will sometimes fail.
|
|
The \fB\-z\fP flag (see above) tells \fBpidof\fP to try to detect these sleeping and zombie
|
|
processes, at the risk of failing or hanging.
|
|
|
|
.SH SEE ALSO
|
|
.BR shutdown (8),
|
|
.BR init (8),
|
|
.BR halt (8),
|
|
.BR reboot (8),
|
|
.BR killall5 (8)
|
|
.SH AUTHOR
|
|
.MT miquels@\:cistron\:.nl
|
|
Miquel van Smoorenburg
|
|
.ME
|