checkproc(8)
NAME
Checkproc - Checks for a process by full path name
Pidofproc - Checks for a process by exec base name
SYNOPSIS
checkproc [-v] [-L] [-k] [-p pid_file] [-c root] [-z]
/full/path/to/executable
checkproc [-v] [-k] [-n] name_of_kernel_thread
pidofproc [-k] basename_of_executable
DESCRIPTION
checkproc checks for running processes that use the speci
fied executable.
checkproc does not use the pid to verify a process but the
full path of the corresponding program which is used to
identify the executable (see proc(5)). Only if the inode
number (/proc/<pid>/exe) and the full name are unavailable
(/proc/<pid>/cmdline) or if the executable changes its
zeroth argument, checkproc uses the base name
(/proc/<pid>/stat) to identify the running program. Note
that if the option -n for kernel thread is given only
(/proc/<pid>/stat) is used. For this case a existing sym
bolic link (/proc/<pid>/exe) indicates that the <pid> is
not a kernel thread.
Extended functionality is provided by the -p pid_file
option (former option -f changed due to the LSB specifica
tion). If this option is specified, checkproc tries to
check the pid read from this file instead of the default
(/var/run/<basename>.pid). The pid read from this file is
compared against the pids of the processes that uses the
specified binary. Note that the behaviour is changed by
the option -k. With this option, the pid read from the
pid file is the only used pid (see killproc(8)). Without
this option, the pid read from the pid file is used to
search the process table for a process with an executable
that matches the specified pathname. In order to avoid
confusion with stale pid files, a not up-to-date pid will
be ignored (see startproc(8)).
The option -v makes checkproc print out verbose messages.
The same happens if pidofproc LSB variant is used. This
version also accepts also the base name only of a exe
cutable. Note that this disables the comparision of the
inodes of the executable and the information found within
the proc table (see proc(5)).
REQUIRED
- /full/path/to/executable or name_of_kernel_thread
- Specifies the executable which processes should be
found, or alternatively, if the option Or alter
nated, if option -n is used, the name of the kernel
thread. This argument is always required.
OPTIONS
- -k This option makes checkproc work like killproc(8)
- which changes the operation mode, e.g. the exit
status of the program will be that of killproc(8) and startproc(8). Without this option, checkproc works like startproc (8) and finds all processes with an executable that matches the specified path
name, even if a given pid file (see option -p)
isn't up-to-date. Nevertheless it uses its own exit
status (see section EXIT CODES). - -L This option causes symlinks to be followed, as the
- like-named option in ls(1). Note: for the file
name the original name of the program is used
instead of the name of the symbolic link. - -p pid_file
- Former option -f changed due to the LSB specifica
tion.) Use an alternate pid file instead of the
default /var/run/<basename>.pid. - -c root
- Change root directory to root for services which
have been started with this option by startproc(8). - -n This option indicates that a kernel thread should
- be checked. In this case not the executable with
its full path name is required but the name of the
kernel thread. - -q This option is ignored.
- -v Verbose output.
- -z This option causes checkproc to see processes even
- if they are in the zombie state. Without this
option zombies are handled as not existent because
such a process isn't alive but listed in the pro
cess table and waits on its parent process.
EXAMPLE
- checkproc /usr/sbin/sendmail
- returns all pids of running sendmail processes.
- checkproc -p /var/myrun/lpd.pid /usr/sbin/lpd
returns the command line or the basename of the
process pid found in /var/run/lpd.pid.
EXIT CODES
- The exit codes have the following LSB conform conditions:
- 0 Process is running
1 No process but pid file found
3 No process and no pid file found - 101 Wrong syntax on command line
102 Other errors - If the option -k is used checkproc uses exit codes like
startproc(8) and killproc(8) do. - in some cases a message is send to standard error or, if
no standard error available, syslogd(8) is used.
NOTE
checkproc together with the option -v just like pidof(8).
The only difference is the usage of an available pid file.
Only if no usable pid is given with a pid file the process
table will be scanned.
BUGS
Identifying a process based on the executable file and the
corresponding inode number only works if the process stays
alive during startproc's execution. Processes rewriting
their zeroth argument or shell scripts (the inode number
of the shell executable file is not identical to that of
the script file) may not be identified by a filename path.
FILES
/proc/ path to the proc file system (see proc(5)).
- /etc/init.d/
- path to the SuSE boot concept script base directory
as required by the Linux Standard Base Specifica
tion (LSB) (see init.d(7)).
SEE ALSO
startproc(8), killproc(8), insserv(8), init.d(7), kill(1), skill(1), killall(8), killall5(8), signal(7), proc(5).
COPYRIGHT
1994-2000 Werner Fink, 1996-2000 SuSE GmbH Nuernberg, Ger
many.
AUTHOR
- Werner Fink <werner@suse.de>