Index: TOOLS/PACK_IPSL/enlarge_my_files.sh
===================================================================
--- TOOLS/PACK_IPSL/enlarge_my_files.sh	(revision 1768)
+++ TOOLS/PACK_IPSL/enlarge_my_files.sh	(revision 1822)
@@ -89,4 +89,39 @@
 }
 
+# gpdebug : pour test showPackProgress.sh *************************
+export RANDOM=$$
+
+function gives_0_or_1
+{
+   bit=-1
+   let "bit = RANDOM % 2"
+   echo $bit
+}
+
+resultCmd=
+# gpdebug : ****************************** fin ********************
+
+
+#********** gpdebug : mesure d'intervalles de temps ***************
+function getDateMilliSeconds
+{
+   test=`date +%s%N`
+   testnum=${#test}
+   millisec=${test:0:$testnum-6}
+   echo "$millisec"
+}
+
+function getTimeDiffSeconds
+{
+   startTimeMilliSec=$1
+   endTimeMilliSec=$( getDateMilliSeconds )
+   
+   diffMilliSec=$(( $endTimeMilliSec - $startTimeMilliSec ))
+   
+   diffSeconds=$(awk 'BEGIN { print '$diffMilliSec'/'1000' }')
+   echo "$diffSeconds"  
+
+}
+# gpdebug : ****************************** fin ********************
 #------------------------------------------------------
 for set in $( ls $PATH_SIMU/output_ncrcat/*list ) ; do
@@ -158,9 +193,16 @@
 	# Try 2 times before fire "FAILED"
 	ncrcatcmd=ncrcat
-	ncrcatoptions="--md5_digest"
-#	ncrcatoptions=""
-
-	cat $set | $ncrcatcmd $ncrcatoptions -O -x -v $varstoexclude -o $outputfile > $logfile 2>&1
+#	ncrcatoptions="--md5_digest"
+	ncrcatoptions=""
+
+	startTime=$( getDateMilliSeconds ) # gpdebug : time
+	cat $set | $ncrcatcmd $ncrcatoptions -O -x -v $varstoexclude -o $outputfile > $logfile 2>&1 # gpdebug : a retablir
+	meantime=$( getTimeDiffSeconds $startTime ) # gpdebug : time
+	
+	# resultCmd=$( gives_0_or_1 )
+	# resultCmd=1
+	# if [ $resultCmd -eq 0 ] ; then
 	if [ $? -eq 0 ] ; then
+	        sed -i "1i\meantime:${meantime}" $statusfile # gpdebug : time
 		datestr2=`LC_ALL=C date +"%Y-%m-%dT%H:%M:%S"`
 		echo "DONE ; $datestr1 ; $datestr2 ; cat $set | $ncrcatcmd $ncrcatoptions -O -x -v '$varstoexclude' -o $outputfile ; $logfile ; $extratar" >> $statusfile
@@ -169,6 +211,12 @@
 	else
 		# Add --md5_digest
-		cat $set | $ncrcatcmd $ncrcatoptions -O -x -v $varstoexclude -o $outputfile > $logfile 2>&1
+		startTime=$( getDateMilliSeconds ) # gpdebug : time
+		cat $set | $ncrcatcmd $ncrcatoptions -O -x -v $varstoexclude -o $outputfile > $logfile 2>&1 # gpdebug : a retablir
+		meantime=$( getTimeDiffSeconds $startTime ) # gpdebug : time
+	        # resultCmd=$( gives_0_or_1 )
+		# resultCmd=1
+	        # if [ $resultCmd -eq 0 ] ; then
 		if [ $? -eq 0 ] ; then
+		        sed -i "1i\meantime:${meantime}" $statusfile # gpdebug : time
 			datestr2=`LC_ALL=C date +"%Y-%m-%dT%H:%M:%S"`
 			echo "DONE ; $datestr1 ; $datestr2 ; cat $set | $ncrcatcmd $ncrcatoptions -O -x -v '$varstoexclude' -o $outputfile ; $logfile ; $extratar" >> $statusfile
@@ -178,9 +226,9 @@
 			datestr2=`LC_ALL=C date +"%Y-%m-%dT%H:%M:%S"`
 			echo "====> FAILED at try #$nbtries" 
-			echo "FAILED ; $datestr1 ; $datestr2 ; cat $set | $ncrcatcmd $ncrcatoptions -O -x -v '$varstoexclude' -o $outputfile ; $logfile ; $extratar" >> $statusfile
+			echo "FAILED at try #$nbtries ; $datestr1 ; $datestr2 ; cat $set | $ncrcatcmd $ncrcatoptions -O -x -v '$varstoexclude' -o $outputfile ; $logfile ; $extratar" >> $statusfile
 			if [ $nbtries -ge $maxtries ] ; then
 				echo "====> DELEGATE to tar command after $nbtries tries (maxtries=$maxtries)"
 				echo "DELEGATE to tar command after $nbtries tries (maxtries=$maxtries)" >> $statusfile
-				cp $set $PATH_SIMU/output_tar
+				# cp $set $PATH_SIMU/output_tar # gpdebug : a retablir
 			fi
 		fi
@@ -238,6 +286,6 @@
 	# Waiting for CCRT command
 	tarcmd=tar
-	taroptions="--format=posix -W -cf"
-	
+#	taroptions="--format=posix -W -cf"
+	taroptions="--format=posix -cf"
 	cd $dirinputfile
 
@@ -248,7 +296,12 @@
 	    
 # 	#-----------------------------------
-
-	$tarcmd $taroptions $outputfile --dereference --files-from $set.local > $logfile 2>&1
+        startTime=$( getDateMilliSeconds ) # gpdebug : time
+	$tarcmd $taroptions $outputfile --dereference --files-from $set.local > $logfile 2>&1 # gpdebug : a retablir
+	meantime=$( getTimeDiffSeconds $startTime ) # gpdebug : time
+	
+	# resultCmd=$( gives_0_or_1 )
+	# if [ $resultCmd -eq 0 ] ; then
 	if [ $? -eq 0 ] ; then
+	    sed -i "1i\meantime:${meantime}" $statusfile # gpdebug : time
 	    datestr2=`LC_ALL=C date +"%Y-%m-%dT%H:%M:%S"`
 	    echo "DONE ; $datestr1 ; $datestr2 ; $tarcmd $taroptions $outputfile $(cat $set); $logfile" >> $statusfile
@@ -258,5 +311,5 @@
 	    datestr2=`LC_ALL=C date +"%Y-%m-%dT%H:%M:%S"`
 	    echo "====> FAILED at try #$nbtries" 
-	    echo "FAILED ; $datestr1 ; $datestr2 ; $tarcmd $taroptions $outputfile $(cat $set) ; $logfile" >> $statusfile
+	    echo "FAILED at try #$nbtries ; $datestr1 ; $datestr2 ; $tarcmd $taroptions $outputfile $(cat $set) ; $logfile" >> $statusfile
 
 	fi
@@ -314,11 +367,17 @@
 	# Waiting for CCRT command
 	tarcmd=tar
-	taroptions="--format=posix -W -cf"
-	
+#	taroptions="--format=posix -W -cf"
+	taroptions="--format=posix -cf"
 	cd $dirin1
 #	ls
 	
-	$tarcmd $taroptions $outputfile --dereference --files-from $set > $logfile 2>&1
+	startTime=$( getDateMilliSeconds ) # gpdebug : time
+	$tarcmd $taroptions $outputfile --dereference --files-from $set > $logfile 2>&1 # gpdebug : a retablir
+	meantime=$( getTimeDiffSeconds $startTime ) # gpdebug : time
+	
+	# resultCmd=$( gives_0_or_1 )
+	# if [ $resultCmd -eq 0 ] ; then
 	if [ $? -eq 0 ] ; then
+	    sed -i "1i\meantime:${meantime}" $statusfile # gpdebug : time
 	    datestr2=`LC_ALL=C date +"%Y-%m-%dT%H:%M:%S"`
 	    echo "DONE ; $datestr1 ; $datestr2 ; $tarcmd $taroptions $outputfile $(cat $set); $logfile" >> $statusfile
@@ -328,5 +387,5 @@
 	    datestr2=`LC_ALL=C date +"%Y-%m-%dT%H:%M:%S"`
 	    echo "====> FAILED at try #$nbtries" 
-	    echo "FAILED ; $datestr1 ; $datestr2 ; $tarcmd $taroptions $outputfile $(cat $set) ; $logfile" >> $statusfile
+	    echo "FAILED at try #$nbtries ; $datestr1 ; $datestr2 ; $tarcmd $taroptions $outputfile $(cat $set) ; $logfile" >> $statusfile
 
 	fi
@@ -382,11 +441,17 @@
 	# Waiting for CCRT command
 	tarcmd=tar
-	taroptions="--format=posix -W -cf"
-	
+#	taroptions="--format=posix -W -cf"
+	taroptions="--format=posix -cf"
 	cd $dirin1
 #	ls
-	
-	$tarcmd $taroptions $outputfile --dereference --files-from $set > $logfile 2>&1
+
+	startTime=$( getDateMilliSeconds ) # gpdebug : time
+	$tarcmd $taroptions $outputfile --dereference --files-from $set > $logfile 2>&1 # gpdebug : a retablir
+	meantime=$( getTimeDiffSeconds $startTime ) # gpdebug : time
+	
+	# resultCmd=$( gives_0_or_1 )
+	# if [ $resultCmd -eq 0 ] ; then
 	if [ $? -eq 0 ] ; then
+	    sed -i "1i\meantime:${meantime}" $statusfile # gpdebug : time
 	    datestr2=`LC_ALL=C date +"%Y-%m-%dT%H:%M:%S"`
 	    echo "DONE ; $datestr1 ; $datestr2 ; $tarcmd $taroptions $outputfile $(cat $set); $logfile" >> $statusfile
@@ -396,5 +461,5 @@
 	    datestr2=`LC_ALL=C date +"%Y-%m-%dT%H:%M:%S"`
 	    echo "====> FAILED at try #$nbtries" 
-	    echo "FAILED ; $datestr1 ; $datestr2 ; $tarcmd $taroptions $outputfile $(cat $set) ; $logfile" >> $statusfile
+	    echo "FAILED at try #$nbtries ; $datestr1 ; $datestr2 ; $tarcmd $taroptions $outputfile $(cat $set) ; $logfile" >> $statusfile
 
 	fi
@@ -447,8 +512,13 @@
 	    cpcmd="cp "
 	    cpoptions="-rf"
-	    $cpcmd $cpoptions $file $diroutputfile > $logfile 2>&1
+	    startTime=$( getDateMilliSeconds ) # gpdebug : time
+	    $cpcmd $cpoptions $file $diroutputfile > $logfile 2>&1 # gpdebug : a retablir
+	    meantime=$( getTimeDiffSeconds $startTime ) # gpdebug : time
 	done
-
+	
+	# resultCmd=$( gives_0_or_1 )
+	# if [ $resultCmd -eq 0 ] ; then
 	if [ $? -eq 0 ] ; then
+	    sed -i "1i\meantime:${meantime}" $statusfile # gpdebug : time
 	    datestr2=`LC_ALL=C date +"%Y-%m-%dT%H:%M:%S"`
 	    echo "DONE ; $datestr1 ; $datestr2 ; $cpcmd $cpoptions $file $diroutputfile ; $logfile" >> $statusfile
@@ -458,5 +528,5 @@
 	    datestr2=`LC_ALL=C date +"%Y-%m-%dT%H:%M:%S"`
 	    echo "====> FAILED at try #$nbtries" 
-	    echo "FAILED ; $datestr1 ; $datestr2 ; $cpcmd $cpoptions $file $diroutputfile ; $logfile" >> $statusfile
+	    echo "FAILED at try #$nbtries ; $datestr1 ; $datestr2 ; $cpcmd $cpoptions $file $diroutputfile ; $logfile" >> $statusfile
 
 	fi
@@ -509,8 +579,13 @@
 	    cpcmd="cp "
 	    cpoptions="-rf"
-	    $cpcmd $cpoptions $file $diroutputfile > $logfile 2>&1
+	    startTime=$( getDateMilliSeconds ) # gpdebug : time
+	    $cpcmd $cpoptions $file $diroutputfile > $logfile 2>&1  # gpdebug : a retablir
+	    meantime=$( getTimeDiffSeconds $startTime ) # gpdebug : timeS
 	done
-
+	
+	# resultCmd=$( gives_0_or_1 )
+	# if [ $resultCmd -eq 0 ] ; then
 	if [ $? -eq 0 ] ; then
+	    sed -i "1i\meantime:${meantime}" $statusfile # gpdebug : time
 	    datestr2=`LC_ALL=C date +"%Y-%m-%dT%H:%M:%S"`
 	    echo "DONE ; $datestr1 ; $datestr2 ; $cpcmd $cpoptions $file $diroutputfile ; $logfile" >> $statusfile
@@ -520,5 +595,5 @@
 	    datestr2=`LC_ALL=C date +"%Y-%m-%dT%H:%M:%S"`
 	    echo "====> FAILED at try #$nbtries" 
-	    echo "FAILED ; $datestr1 ; $datestr2 ; $cpcmd $cpoptions $file $diroutputfile ; $logfile" >> $statusfile
+	    echo "FAILED at try #$nbtries ; $datestr1 ; $datestr2 ; $cpcmd $cpoptions $file $diroutputfile ; $logfile" >> $statusfile
 
 	fi
