#!/usr/bin/perl
#
# Action module for Ant monitoring system
#
#  Restarts cleo server
#
# Agruments: none
#
#

use Fcntl;

$|=1;

my ($p,$line);

fcntl(STDIN,F_SETFL,fcntl(STDIN,F_GETFL,0)|O_NONBLOCK);

for(;;){
  $line='';
INNER_LOOP:
  for(;;){
    while(read(STDIN,$p,1)>0){
      last INNER_LOOP if $p eq "\n";
      $line.=$p;
    }
    select(undef,undef,undef,0.15);
  }
  system 'rsh $line /etc/init.d/cleo restart 2>/dev/null >/dev/null';
}

