#!/bin/perl use strict; use warnings; my $pid = fork(); unless ($pid) { exec "nc -l 7777" or die; } local $SIG{ALRM} = sub { print "Command timed out!\n"; kill 9, $pid; }; alarm 2; waitpid $pid, 0; alarm 0;
In reply to Re: Kill a command launched within script
by zwon
in thread Kill a command launched within script
by ceweldon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |