2009-09-10 13:58:49 +05:30
|
|
|
'\" -*- 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 ]
|
2010-02-23 22:21:18 +05:30
|
|
|
.RB [ \-n ]
|
2009-09-10 13:58:49 +05:30
|
|
|
.RB [ \-x ]
|
|
|
|
.RB [ \-o
|
2010-02-23 22:21:18 +05:30
|
|
|
.IR omitpid[,omitpid..] ]
|
2009-09-10 13:58:49 +05:30
|
|
|
.RB [ \-o
|
2010-02-23 22:21:18 +05:30
|
|
|
.IR omitpid[,omitpid..].. ]
|
2009-09-10 13:58:49 +05:30
|
|
|
.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
|
2010-02-23 22:21:18 +05:30
|
|
|
.IP \-s
|
2009-09-10 13:58:49 +05:30
|
|
|
Single shot - this instructs the program to only return one \fIpid\fP.
|
2010-02-23 22:21:18 +05:30
|
|
|
.IP \-c
|
2009-09-10 13:58:49 +05:30
|
|
|
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.
|
2010-02-23 22:21:18 +05:30
|
|
|
.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
|
2009-09-10 13:58:49 +05:30
|
|
|
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.
|
|
|
|
.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
|