#!/usr/bin/perl -w #$file: watchProcess.pl - watch whether a proccess is running. use strict; use POSIX; my $pid = shift; die "usage: watchProccess pid\n" unless defined $pid; my $times =0; do{ sleep(5); $times++; print "loop: $times\n"; }until kill(SIGCHLD,$pid)==0; print "proccess $pid is end.\n";
You are here: Home > perl > Check whether a process is running or not
Saturday, May 26, 2007
Check whether a process is running or not
The example Perl code demonstrate checking whether a process is running or not.