sysvinit/man/pidof.8
Werner Fink f69ea1f550 * Add fix for Debian bug #536574 -- Can be enabled by -DACCTON_OFF
* Add helper program fstab-decode to make it easier to handle
   /etc/mtab content. Patch by Miloslav Trmac and Fedora.
 * Add fix for Debian bug #335023 - Make sure TERM is set on FreeBSD.
 * Add fix for Debian bug #374038 - Make it clear that shutdown -c can
   only cancel a waiting shutdown, not an active one.
 * Add not to pidof manual page about the use of readlink(2). Patch by
   Bill Nottingham and Fedora.
 * Add changes for Debian bug #68621 - Add PAM support for programs spawned
   by init on the console like sulogin. Based on patch by Topi Miettinen.
2010-03-23 14:37:01 +00:00

93 lines
3.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" "" "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 [ \-o
.IR omitpid[,omitpid..] ]
.RB [ \-o
.IR omitpid[,omitpid..].. ]
.B program
.RB [ 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 /etc/rc?.d, where ? is the runlevel. If the system has
a
.B start-stop-daemon
(8) program that should be used instead.
.SH OPTIONS
.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.
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
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 the variable
.B PIDOF_NETFS
may be set and exported.
.IP \-x
Scripts too - this causes the program to also return process id's of
shells running the named scripts.
.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 \fIpidof\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 \fIkillall5\fP;
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
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),
so symbolic links to executables will also match.
.SH SEE ALSO
.BR shutdown (8),
.BR init (8),
.BR halt (8),
.BR reboot (8),
.BR killall5 (8)
.SH AUTHOR
Miquel van Smoorenburg, miquels@cistron.nl