GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  PIDWATCH (1)

.ds Aq ’

NAME

pidwatch - Run a command and if another PID exits, kill the command

CONTENTS

SYNOPSIS



  pidwatch [--cd I<cd>] --host <host> --pid <pid>  args[....]
  pidwatch [--cd I<cd>] --host <host> --pid <pid> --foreground <pid>



DESCRIPTION

Chdir to the specified directory, if specified and possible, then run the arguments as a command in the foreground. When the foreground process exits, return its exit status. This is basically the same as running the command directly.

In the background, watch the specified pid on the specified host. If pidstatd is running on the specified host, and the specified pid goes away, kill the foreground command.

Alternatively pass the PID of any process with --foreground. When the foreground process exits, the background job exits; if the specified watched PID exits, the foreground pid is killed.

Common usage is to kill remote rsh children when a parent is kill -9ed. An example Perl application would invoke:



    system("rsh \$remote_host pidwatch"
           ." --cd \$ENV{PWD} --host \$ENV{HOST} --pid \$\$"
           ."\$remote_command...");



Another usage is as a barrier to start the new step in a script when another process completes. Just use a sleep with a appropriate timeout value:



    pidwatch --host HOST --pid PID sleep 9999999
    echo PID has completed, do whatever is next



ARGUMENTS

<parameters> All non switch arguments after the switches are passed to /bin/sh as a -c argument. Thus passing a && b to pidwatch will result in pidwatch executing /bin/sh -c ’a && b’.
--cd dir Directory to chdir to.
--help Displays this message and program version and exits.
--host host Hostname to check for specified pid on. pidstatd must be running on that host to have this program be useful.
--killer program Program to use instead of kill when it’s time to terminate the pid. Will be passed arguments as if it was /bin/kill (program signame pid).
--foreground pid Process ID to be killed when watched process exits. Used to watch a preexisting PID, instead of launching commands under a shell.
--pid pid Process ID to watch. When this pid exits, the program will kill the foreground process.
--port port Port of pidstatd server on remote host.
--signal signame Signal number/name to send to process on remote PIDs death. Defaults to -HUP.
--version Displays program version and exits.

DISTRIBUTION

The latest version is available from CPAN and from <http://www.veripool.org/>.

Copyright 2002-2013 by Wilson Snyder. This package is free software; you can redistribute it and/or modify it under the terms of either the GNU Lesser General Public License Version 3 or the Perl Artistic License Version 2.0.

AUTHORS

Wilson Snyder <wsnyder@wsnyder.org>

SEE ALSO

IPC::Locker, IPC::PidStat, pidstat, pidstatd, uriexec
Search for    or go to Top of page |  Section 1 |  Main Index


perl v5.20.3 PIDWATCH (1) 2013-01-31

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.