#!/usr/bin/perl -w

use warnings;
use strict;
use Getopt::Long;

my $server = undef;
GetOptions ("server|s=s" => \$server);

my @cmdOut = `echo "status ;quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`;
my $line;
my $foundStatus = 0;
my $isRunning = 0;
foreach $line (@cmdOut) {

    chomp($line);
    if ($line =~ m/Scheduler is stopped/) {$isRunning = 0; $foundStatus=1;last;}
    if ($line =~ m/Scheduler is running/) {$isRunning = 1; $foundStatus=1;last;}
    if ($line =~ m/Task Staus/) {last;}

}

($foundStatus) ? print "yes\n" : print "no\n";
($isRunning) ? print "yes\n" : print "no\n";

