#! /usr/bin/env perl
use Getopt::Long;
use File::Copy;
use Cwd;
use Soar;
use CondorUtils;

Soar::DebugOff();

$jobout = "./doextract.out";
$savefile = "./ENVVARS";

# Dagman passes node which maps to both where the job is running
$rundir = $ARGV[0];
$cwd = getcwd();

print "Starting wrapup here for run<$rundir>\n";

Soar::DebugOff();
Soar::ReadSetEnv($savefile);

$topdir = $ENV{TOPDIR};
$runloc = $ENV{RUNLOC};
$resultsloc = $ENV{RESLOC};
$tarcache = $ENV{TARCACHE};
$datasets = $ENV{DATASETS};

my $htmlloc = LookupFsConfig("HTMLLOC");

print "Top = $topdir\n";
print "DATA = $datasets\n";
print "RESULTS = $resultsloc\n";
print "RUNDIR = $runloc\n";
print "TARCACHE = $tarcache\n";
print "CWD = $cwd\n";

CutRunFromCron($rundir, "$htmlloc/checkprogress.cron", "$htmlloc/CRON");
exit(0);


# =================================
# print help
# =================================

sub help
{
    print "Usage: wrapup.pl rundir
        Options:
            [-h/--help]                             See this
			\n";
}
