Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

killing a system process after timeout

Status
Not open for further replies.

riksena

Technical User
Sep 29, 2010
1
0
0
GB
Hi,

I'm having problems with a perl program I've written to query disks on a UNIX system. The problem i'm having is around a system process that is launched against each disk in turn. Unfortunately, on some disks, this process will hang so I have built in a 5 seconds alarm to allow the program to continue. This works ok but it leaves the process running on the system and I can't seem to find out how to kill this process after the timeout:

eval {
local $SIG{ALRM} = sub {die "alarm\n"};
alarm 5;
$vgid = `/usr/bin/echo 0x2008?4d | adb /dev/disk/$sdisk 2> /dev/null`;
alarm 0;
};
if ($@) {
$vgid = "unset";
}

I also need the output of the system command in $vgid so don't think I can use exec?

Any ideas :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top