#!/usr/bin/perl -w

##########################################################################################
#
#  stressSuite
#
#  A Perl script to test the srmV2
#
#  Author: Gilbert Grosdidier, LAL (Universite Paris-Sud, Orsay)
#  Creation Date  : 3/11/2004
#  Migration :     27/12/2004
#  Last rev:       23/05/2007 (GG)
#
##########################################################################################

###
### Copyright (C) 2004-2007 by CERN/IT/GD/CT & CNRS/IN2P3/LAL
### All rights reserved
###

# $Id: srmv2Stress,v 1.4 2007/05/24 05:50:53 grodid Exp $
# Usage: srmv2Stress lxgate22 50 2100 [domain]

use strict;

my $mach   = shift;
my $many   = shift;
my $label  = shift;
my $domain = shift || "cern.ch";
$label--;

##my $command = "time srmv2Suite ${mach}.${domain} 8446 grodid filestress$lab dteam subdirst$lab > /tmp/suite-SLC3-${mach}-sec.lis";

foreach my $cn ( 1 .. $many ) {
    my $lab = $label + $cn;
    my $laber = $label + 1;
##$ENV{CGSI_TRACE} = "1";
##$ENV{CGSI_TRACEFILE} = "/tmp/grodid/cgsi_trace/cgsi_trace-${mach}.lis$lab";
$ENV{TEMPDIR} = "/var/tmp/grodid/stress/subdirst$lab";
    system("mkdir -p $ENV{TEMPDIR}");
    my $command = "time srmv2Suite ${mach}.${domain} 8446 grodid filest$lab dteam grodid/stress/rn$laber/sd$lab > /var/tmp/grodid/stress/suite-SLC4-${mach}.lis";
    my $cm = "nohup $command$lab 2>&1 &";
    print "CM: >> $cm << \n";
    system ("$cm");
}

exit 0;
