NAME

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

SYNOPSIS

pidwatch [--cd cd] --host host --pid pid [args....]

DESCRIPTION

Chdir to the specified directory, if specified and possible.

Run the arguments as a command in the foreground. When the foreground process exits, return its exit status.

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.

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...");

ARGUMENTS

--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).

--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.

SEE ALSO

IPC::PidStat

AUTHORS

Wilson Snyder <wsnyder@wsnyder.org>