#!/usr/bin/perl

my $starttime = time;


# actually run the job. 
# in this example, our job is a FLEXlm-wrapped verison of
# perl (because it was easy to use SAMwrap to create it, and
# by having it be a perl script we can have the executable do aynthing
# we want
`/home/epaulson/license/bin/perl /home/epaulson/license/bin/foo.pl`;

# FLEXlm will only log about once every 20 seconds or so - give the
# license server "long enough" to write it's state out to disk
sleep(30);

my $now = time;
chmod 0755, "client";
my $denied = `./client --host flexlm.cs.wisc.edu --starttime $starttime --endtime $now`;

chomp($denied);

if ($denied eq "NO") {
#This is the successful case, exit with zero 
exit 0;
}

exit 1;
