[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] Expect?
On Wed, 2011-02-09 at 12:59 -0700, Robert L. Harris wrote:
> The problem is the streambaby process will throw the java.io error but
> not die. I just want to kill it and respawn it, wait for it to die
> again. if I could get the kill command to work I'd be set.
#!/usr/bin/perl
use Expect;
use strict;
sub worker {
my $exp = Expect->spawn("/usr/local/streambaby/streambaby");
$exp->expect(undef, "java.io.IOException");
print " **** Killing *****\n";
my $pid = `pgrep -f 'java.*streambaby.jar'`;
chomp $pid;
kill 9, $pid;
return;
}
while(1) {
worker();
}
Multiple ways to solve the problem.
- Follow-Ups:
- [ale] Expect?
- From: robert.l.harris at gmail.com (Robert L. Harris)