]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGPP/QA/scripts/runQA.sh
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGPP / QA / scripts / runQA.sh
1 #!/bin/bash
2 main()
3 {
4   if [[ -z $1 ]]; then
5     echo "Usage: "
6     echo "  ${0##*/} option=value [option=value]"
7     echo "  at least inputList should be specified, or configFile containing it:"
8     echo "  ${0##*/} inputList=file.list"
9     echo "  options override config file (if any), e.g.:"
10     echo "  ${0##*/} configFile=runQA.config inputList=file.list outputDirectory=%det"
11     return 1
12   fi
13  
14   if ! parseConfig "$@"; then
15     ${0}
16     return 1
17   fi
18
19   [[ -z $ALICE_ROOT ]] && echo "ALICE_ROOT not defined" && return 1
20
21   ocdbregex='raw://'
22   if [[ ${ocdbStorage} =~ ${ocdbregex} ]]; then
23     alien-token-init ${alienUserName}
24     #this is a hack! alien-token init seems not enough
25     #but the gclient_env script messes up the LD_LIBRARY_PATH
26     while read x; do
27       eval ${x};
28     done < <(grep -v "LD_LIBRARY_PATH" /tmp/gclient_env_${UID})
29   fi
30
31   updateQA "$@"
32 }
33
34 updateQA()
35 {
36   umask 0002
37   parseConfig "$@"
38
39   #be paranoid and make some full paths
40   [[ ! -f ${inputList} ]] && echo "no input list: ${inputList}" && return 1
41   inputList=$(get_realpath ${inputList})
42   mkdir -p ${workingDirectory}
43   workingDirectory=$(workingDirectory=${workingDirectory%/}; cd ${workingDirectory%/*}; echo "${PWD}/${workingDirectory##*/}")
44   if [[ ! -d ${workingDirectory} ]]; then
45     echo "working dir $workingDirectory does not exist and cannot be created"
46     return 1
47   fi
48   cd ${workingDirectory}
49
50   echo JOB config:
51   echo inputList=$inputList
52   echo outputDirectory=$outputDirectory
53   echo
54
55   dateString=$(date +%Y-%m-%d-%H-%M-%S-%N)
56   echo "Start time QA process: $dateString"
57
58   #logging
59   mkdir -p $logDirectory
60   [[ ! -d $logDirectory ]] && echo "no log dir $logDirectory" && return 1
61   logFile="$logDirectory/${0##*/}.${dateString}.log"
62   touch ${logFile}
63   [[ ! -f ${logFile} ]] && echo "cannot write logfile $logfile" && return 1
64   echo "logFile = $logFile"
65
66   #check lock
67   lockFile=${workingDirectory}/runQA.lock
68   [[ -f ${lockFile} ]] && echo "lock ${lockFile} exists!" | tee ${logFile} && return 1
69   touch ${lockFile}
70   [[ ! -f ${lockFile} ]] && echo "cannot lock $lockFile" | tee ${logFile} && return 1
71   
72   exec &>${logFile}
73
74   ################################################################
75   #ze detector loop
76   for detectorScript in $ALICE_ROOT/PWGPP/QA/detectorQAscripts/*; do
77     echo
78     echo "##############################################"
79     echo $(date)
80     unset planB
81     [[ ! ${detectorScript} =~ .*\.sh$ ]] && continue
82     detector=${detectorScript%.sh}
83     detector=${detector##*/}
84     
85     #skip if excluded
86     if [[ "${excludeDetectors}" =~ ${detector} ]]; then
87       echo "${detector} is excluded in config, skipping..."
88       continue
89     fi
90
91     #if includeDetectors set, only process thoe detectors specified there
92     if [[ -n ${includeDetectors} && ! "${includeDetectors}" =~ ${detector} ]]; then
93       echo "${detector} not included in includeDetectors, skipping..."
94       continue
95     fi
96
97     logSummary=${logDirectory}/summary-${detector}-${dateString}.log
98     hostInfo >> ${logSummary}
99     outputDir=$(substituteDetectorName ${detector} ${outputDirectory})
100     tmpDetectorRunDir=${workingDirectory}/tmpQAtmpRunDir${detector}-${dateString}
101     if ! mkdir -p ${tmpDetectorRunDir}; then
102       echo "cannot create the temp dir $tmpDetectorRunDir"
103       continue
104     fi
105     cd ${tmpDetectorRunDir}
106
107     tmpPrefix=${tmpDetectorRunDir}/${outputDir}
108     echo "running QA for ${detector}"
109     echo "  outputDir=$outputDir"
110     echo "  tmpPrefix=$tmpPrefix"
111     
112     #unset the detector functions from previous iterations (detectors)
113     unset -f runLevelQA
114     unset -f periodLevelQA
115     unset -f runLevelHighPtTreeQA
116     unset -f periodLevelHighPtTreeQA
117     source ${detectorScript}
118
119     #################################################################
120     #produce the QA and trending tree for each file (run)
121     unset arrOfTouchedProductions
122     declare -A arrOfTouchedProductions
123     while read qaFile; do
124       echo
125       echo $(date)
126       
127       #first check if input file exists
128       [[ ! -f ${qaFile%\#*} ]] && echo "file ${qaFile%\#*} not accessible" && continue
129
130       if ! guessRunData ${qaFile}; then
131         echo "could not guess run data from ${qaFile}"
132         continue
133       fi
134       echo "anchorYear for ${originalPeriod} is: ${anchorYear}"
135
136       tmpProductionDir=${tmpPrefix}/${dataType}/${year}/${period}/${pass}
137       tmpRunDir=${tmpProductionDir}/000${runNumber}
138       mkdir -p ${tmpRunDir}
139       cd ${tmpRunDir}
140
141       #by default we expect to have everything in the same archive
142       highPtTree=${qaFile}
143
144       #maybe the input is not an archive, but a file
145       [[ "${qaFile}" =~ QAresults.root$ ]] && highPtTree=""
146       [[ "${qaFile}" =~ FilterEvents_Trees.root$ ]] && qaFile=""
147
148       #it is possible we get the highPt trees from somewhere else
149       #search the list of high pt trees for the proper run number
150       if [[ -n ${inputListHighPtTrees} ]]; then
151         highPtTree=$(egrep -m1 ${runNumber} ${inputListHighPtTrees})
152         echo "loaded the highPtTree ${highPtTree} from external file ${inputListHighPtTrees}"
153       fi
154       
155       echo qaFile=$qaFile
156       echo highPtTree=$highPtTree
157       echo ocdbStorage=${ocdbStorage}
158       echo
159
160       #what if we have a zip archive?
161       if [[ "$qaFile" =~ .*.zip$ ]]; then
162         if unzip -l ${qaFile} | egrep "QAresults.root" &>/dev/null; then
163           qaFile="${qaFile}#QAresults.root"
164         elif unzip -l ${qaFile} | egrep "QAresults_barrel.root" &>/dev/null; then
165           qaFile="${qaFile}#QAresults_barrel.root"
166         else
167           qaFile=""
168         fi
169       fi
170       if [[ "$highPtTree" =~ .*.zip$ ]]; then
171         if unzip -l ${highPtTree} | egrep "FilterEvents_Trees.root" &>/dev/null; then
172           highPtTree="${highPtTree}#FilterEvents_Trees.root"
173         else
174           highPtTree=""
175         fi
176       fi
177      
178       if [[ -n ${qaFile} && $(type -t runLevelQA) =~ "function" ]]; then
179         echo running ${detector} runLevelQA for run ${runNumber} from ${qaFile}
180         runLevelQA "${qaFile}" &> runLevelQA.log
181         #perform some default actions:
182         #if trending.root not created, create a default one
183         if [[ ! -f trending.root ]]; then
184           aliroot -b -q -l "$ALICE_ROOT/PWGPP/macros/simpleTrending.C(\"${qaFile}\",${runNumber},\"${detector}\",\"trending.root\",\"trending\",\"recreate\")" 2>&1 | tee -a runLevelQA.log
185         fi
186         if [[ -f trending.root ]]; then
187           arrOfTouchedProductions[${tmpProductionDir}]=1
188         else
189           echo "trending.root not created"
190         fi
191       fi
192       #expert QA based on high pt trees
193       if [[ -n ${highPtTree} && $(type -t runLevelHighPtTreeQA) =~ "function" ]]; then
194         echo running ${detector} runLevelHighPtTreeQA for run ${runNumber} from ${highPtTree}
195         runLevelHighPtTreeQA "${highPtTree}" &> runLevelHighPtTreeQA.log
196         arrOfTouchedProductions[${tmpProductionDir}]=1
197       fi
198
199       cd ${tmpDetectorRunDir}
200     
201     done < ${inputList}
202
203     #################################################################
204     #cache which productions were (re)done
205     echo "list of processed productions:"
206     echo "    ${!arrOfTouchedProductions[@]}"
207     echo
208
209     #################################################################
210     #(re)do the merging/trending 
211     for tmpProductionDir in ${!arrOfTouchedProductions[@]}; do
212       cd ${tmpProductionDir}
213       echo
214       echo "running period level stuff in ${tmpProductionDir}"
215       echo $(date)
216     
217       productionDir=${outputDir}/${tmpProductionDir#${tmpPrefix}}
218       echo productionDir=${outputDir}/${tmpProductionDir#${tmpPrefix}}
219
220       mkdir -p ${productionDir}
221       if [[ ! -d ${productionDir} ]]; then 
222         echo "cannot make productionDir $productionDir" && continue
223       fi
224       
225       #move runs to final destination
226       for dir in ${tmpProductionDir}/000*; do
227         echo 
228         oldRunDir=${outputDir}/${dir#${tmpPrefix}}
229         if ! guessRunData "${dir}/dummyName"; then
230           echo "could not guess run data from ${dir}"
231           continue
232         fi
233
234         #before moving - VALIDATE!!!
235         if ! validate ${dir}; then 
236           continue
237         fi
238
239         #moving a dir is an atomic operation, no locking necessary
240         if [[ -d ${oldRunDir} ]]; then
241           echo "removing old ${oldRunDir}"
242           rm -rf ${oldRunDir}
243         fi
244         echo "moving new ${runNumber} to ${productionDir}"
245         mv -f ${dir} ${productionDir}
246       done
247    
248       #go to a temp dir to do the period level stuff in a completely clean dir
249       tmpPeriodLevelQAdir="${tmpProductionDir}/periodLevelQA"
250       echo
251       echo tmpPeriodLevelQAdir="${tmpProductionDir}/periodLevelQA"
252       if ! mkdir -p ${tmpPeriodLevelQAdir}; then continue; fi
253       cd ${tmpPeriodLevelQAdir}
254
255       #link the final list of per-run dirs here, just the dirs
256       #to have a clean working directory
257       unset linkedStuff
258       declare -a linkedStuff
259       for x in ${productionDir}/000*; do [[ -d $x ]] && ln -s $x && linkedStuff+=(${x##*/}); done
260
261       #merge trending files if any
262       if /bin/ls 000*/trending.root &>/dev/null; then
263         hadd trending.root 000*/trending.root &> periodLevelQA.log
264       fi
265       
266       #run the period level trending/QA
267       if [[ -f "trending.root" && $(type -t periodLevelQA) =~ "function" ]]; then
268         echo running ${detector} periodLevelQA for production ${period}/${pass}
269         periodLevelQA trending.root &>> periodLevelQA.log
270       else 
271         echo "WARNING: not running ${detector} periodLevelQA for production ${period}/${pass}, no trending.root"
272       fi
273
274       if ! validate ${PWD}; then continue; fi
275
276       #here we are validated so move the produced QA to the final place
277       #clean up linked stuff first
278       [[ -n ${linkedStuff[@]} ]] && rm ${linkedStuff[@]}
279       periodLevelLock=${productionDir}/runQA.lock
280       if [[ ! -f ${periodLevelLock} ]]; then
281         #some of the output could be a directory, so handle that
282         #TODO: maybe use rsync?
283         #lock to avoid conflicts:
284         echo "${HOSTNAME} ${dateString}" > ${periodLevelLock}
285         for x in ${tmpPeriodLevelQAdir}/*; do  
286           if [[ -d ${x} ]]; then
287             echo "removing ${productionDir}/${x##*/}"
288             rm -rf ${productionDir}/${x##*/}
289             echo "moving ${x} to ${productionDir}"
290             mv ${x} ${productionDir}
291           fi
292           if [[ -f ${x} ]]; then
293             echo "moving ${x} to ${productionDir}"
294             mv -f ${x} ${productionDir} 
295           fi
296         done
297         rm -f ${periodLevelLock}
298         #remove the temp dir
299         rm -rf ${tmpPeriodLevelQAdir}
300       else
301         echo "ERROR: cannot move to destination"                     >> ${logSummary}
302         echo "production dir ${productionDir} locked!"               >> ${logSummary}
303         echo "check and maybe manually do:"                          >> ${logSummary}
304         echo " rm ${periodLevelLock}"                                >> ${logSummary}
305         echo " rsync -av ${tmpPeriodLevelQAdir}/ ${productionDir}/"  >> ${logSummary}
306         planB=1
307       fi
308
309     done
310
311     cd ${workingDirectory}
312
313     if [[ -z ${planB} ]]; then
314       echo
315       echo removing ${tmpDetectorRunDir}
316       rm -rf ${tmpDetectorRunDir}
317     else
318       executePlanB
319     fi
320   done #end of detector loop
321
322   #remove lock
323   rm -f ${lockFile}
324 }
325
326 executePlanB()
327 {
328   #in case of emergency
329   if [[ -n ${MAILTO} ]]; then 
330     echo
331     echo "trouble detected, sending email to ${MAILTO}"
332     cat ${logSummary} | mail -s "qa in need of assistance" ${MAILTO}
333   fi
334 }
335
336 validate()
337 {
338   summarizeLogs ${1} >> ${logSummary}
339   logStatus=$?
340   if [[ ${logStatus} -ne 0 ]]; then 
341     echo "WARNING not validated: ${1}"
342     planB=1
343     return 1
344   fi
345   return 0
346 }
347
348 summarizeLogs()
349 {
350   local dir=$1
351   [[ ! -d ${dir} ]] && dir=${PWD}
352
353   #print a summary of logs
354   logFiles=(
355       "*.log"
356       "stdout"
357       "stderr"
358   )
359
360   #check logs
361   local logstatus=0
362   for log in ${dir}/${logFiles[*]}; do
363     [[ ! -f ${log} ]] && continue
364     errorSummary=$(validateLog ${log})
365     validationStatus=$?
366     [[ validationStatus -ne 0 ]] && logstatus=1
367     if [[ ${validationStatus} -eq 0 ]]; then 
368       #in pretend mode randomly report an error in rec.log some cases
369       if [[ -n ${pretend} && "${log}" == "rec.log" ]]; then
370         [[ $(( ${RANDOM}%2 )) -ge 1 ]] && echo "${log} BAD random error" || echo "${log} OK"
371       else
372         echo "${log} OK"
373       fi
374     elif [[ ${validationStatus} -eq 1 ]]; then
375       echo "${log} BAD ${errorSummary}"
376     elif [[ ${validationStatus} -eq 2 ]]; then
377       echo "${log} OK MWAH ${errorSummary}"
378     fi
379   done
380
381   #report core files
382   while read x; do
383     echo ${x}
384     chmod 644 ${x}
385     gdb --batch --quiet -ex "bt" -ex "quit" aliroot ${x} > stacktrace_${x//\//_}.log
386   done < <(/bin/ls ${PWD}/*/core 2>/dev/null; /bin/ls ${PWD}/core 2>/dev/null)
387
388   return ${logstatus}
389 }
390
391 validateLog()
392 {
393   log=${1}
394   errorConditions=(
395             'There was a crash'
396             'floating'
397             'error while loading shared libraries'
398             'std::bad_alloc'
399             's_err_syswatch_'
400             'Thread [0-9]* (Thread'
401             'AliFatal'
402             'core dumped'
403             '\.C.*error:.*\.h: No such file'
404             'segmentation'
405             'Interpreter error recovered'
406   )
407
408   warningConditions=(
409             'This is serious'
410   )
411
412   local logstatus=0
413   local errorSummary=""
414   local warningSummary=""
415
416   for ((i=0; i<${#errorConditions[@]};i++)); do
417     local tmp=$(grep -m1 -e "${errorConditions[${i}]}" ${log})
418     [[ -n ${tmp} ]] && tmp+=" : "
419     errorSummary+=${tmp}
420   done
421
422   for ((i=0; i<${#warningConditions[@]};i++)); do
423     local tmp=$(grep -m1 -e "${warningConditions[${i}]}" ${log})
424     [[ -n ${tmp} ]] && tmp+=" : "
425     warningSummary+=${tmp}
426   done
427
428   if [[ -n ${errorSummary} ]]; then 
429     echo "${errorSummary}"
430     return 1
431   fi
432
433   if [[ -n ${warningSummary} ]]; then
434     echo "${warningSummary}"
435     return 2
436   fi
437
438   return 0
439 }
440
441 parseConfig()
442 {
443   args=("$@")
444
445   #config file
446   configFile=""
447   #where to search for qa files
448   inputList=file.list
449   #working directory
450   workingDirectory="${PWD}"
451   #where to place the final qa plots
452   #outputDirectory="/afs/cern.ch/work/a/aliqa%det/www/"
453   outputDirectory="${workingDirectory}/%DET"
454   #filter out detector option
455   excludeDetectors="EXAMPLE"
456   #logs
457   logDirectory=${workingDirectory}/logs
458   #OCDB storage
459   ocdbStorage="raw://"
460   #email to
461   #MAILTO="fbellini@cern.ch"
462
463   #first, check if the config file is configured
464   #is yes - source it so that other options can override it
465   #if any
466   for opt in "${args[@]}"; do
467     if [[ ${opt} =~ configFile=.* ]]; then
468       eval "${opt}"
469       [[ ! -f ${configFile} ]] && echo "configFile ${configFile} not found, exiting..." && return 1
470       echo "using config file: ${configFile}"
471       source "${configFile}"
472       break
473     fi
474   done
475
476   #then, parse the options as they override the options from file
477   for opt in "${args[@]}"; do
478     if [[ ! "${opt}" =~ .*=.* ]]; then
479       echo "badly formatted option ${var}, should be: option=value, stopping..."
480       return 1
481     fi
482     local var="${opt%%=*}"
483     local value="${opt#*=}"
484     echo "${var}=${value}"
485     export ${var}="${value}"
486   done
487 }
488
489 guessRunData()
490 {
491   #guess the period from the path, pick the rightmost one
492   period=""
493   runNumber=""
494   year=""
495   pass=""
496   legoTrainRunNumber=""
497   dataType=""
498   originalPass=""
499   originalPeriod=""
500   anchorYear=""
501
502   shortRunNumber=""
503   oldIFS=${IFS}
504   local IFS="/"
505   declare -a path=( $1 )
506   IFS="${oldIFS}"
507   local dirDepth=$(( ${#path[*]}-1 ))
508   i=0
509   for ((x=${dirDepth};x>=0;x--)); do
510
511     [[ $((x-1)) -ge 0 ]] && local fieldPrev=${path[$((x-1))]}
512     local field=${path[${x}]}
513     local fieldNext=${path[$((x+1))]}
514
515     [[ ${field} =~ ^[0-9]*$ && ${fieldNext} =~ (.*\.zip$|.*\.root$) ]] && legoTrainRunNumber=${field}
516     [[ -n ${legoTrainRunNumber} && -z ${pass} ]] && pass=${fieldPrev}
517     [[ ${field} =~ ^LHC[0-9][0-9][a-z].*$ ]] && period=${field%_*} && originalPeriod=${field}
518     [[ ${field} =~ ^000[0-9][0-9][0-9][0-9][0-9][0-9]$ ]] && runNumber=${field#000}
519     [[ ${field} =~ ^[0-9][0-9][0-9][0-9][0-9][0-9]$ ]] && shortRunNumber=${field}
520     [[ ${field} =~ ^20[0-9][0-9]$ ]] && year=${field}
521     [[ ${field} =~ ^(^sim$|^data$) ]] && dataType=${field}
522     (( i++ ))
523   done
524   originalPass=${pass}
525   [[ -n ${shortRunNumber} && "${legoTrainRunNumber}" =~ ${shortRunNumber} ]] && legoTrainRunNumber=""
526   [[ -z ${legoTrainRunNumber} ]] && pass=${path[$((dirDepth-1))]}
527   [[ "${dataType}" =~ ^sim$ ]] && pass="passMC" && runNumber=${shortRunNumber} && originalPass="" #for MC not from lego, the runnumber is identified as lego train number, thus needs to be nulled
528   [[ -n ${legoTrainRunNumber} ]] && pass+="_lego${legoTrainRunNumber}"
529   
530   #modify the OCDB: set the year
531   if [[ ${dataType} =~ sim ]]; then 
532     anchorYear=$(for x in $mcProductionMap ; do [[ "${x}" =~ ${originalPeriod} ]] && echo ${x} && break; done)
533     anchorYear=${anchorYear#*=}
534     ocdbStorage=$(setYear ${anchorYear} ${ocdbStorage})
535   else
536     ocdbStorage=$(setYear ${year} ${ocdbStorage})
537   fi
538
539   #if [[ -z ${dataType} || -z ${year} || -z ${period} || -z ${runNumber}} || -z ${pass} ]];
540   if [[ -z ${runNumber}} ]]
541   then
542     #error condition
543     return 1
544   else
545     #ALL OK
546     return 0
547   fi
548 }
549
550 substituteDetectorName()
551 {
552   local det=$1
553   local dir=$2
554   [[ ${dir} =~ \%det ]] && det=${det,,} && echo ${dir/\%det/${det}}
555   [[ ${dir} =~ \%DET ]] && det=${det} && echo ${dir/\%DET/${det}}
556 }
557
558 get_realpath() 
559 {
560   if [[ -f "$1" ]]
561   then
562     # file *must* exist
563     if cd "$(echo "${1%/*}")" &>/dev/null
564     then
565       # file *may* not be local
566       # exception is ./file.ext
567       # try 'cd .; cd -;' *works!*
568       local tmppwd="$PWD"
569       cd - &>/dev/null
570     else
571       # file *must* be local
572       local tmppwd="$PWD"
573     fi
574   else
575     # file *cannot* exist
576     return 1 # failure
577   fi
578   # reassemble realpath
579   echo "$tmppwd"/"${1##*/}"
580   return 0 # success
581 }
582
583 setYear()
584 {
585   #set the year
586   #  ${1} - year to be set
587   #  ${2} - where to set the year
588   local year1=$(guessYear ${1})
589   local year2=$(guessYear ${2})
590   local path=${2}
591   [[ ${year1} -ne ${year2} && -n ${year2} && -n ${year1} ]] && path=${2/\/${year2}\//\/${year1}\/}
592   echo ${path}
593   return 0
594 }
595
596 guessYear()
597 {
598   #guess the year from the path, pick the rightmost one
599   local IFS="/"
600   declare -a pathArray=( ${1} )
601   local field
602   local year
603   for field in ${pathArray[@]}; do
604     [[ ${field} =~ ^20[0-9][0-9]$ ]] && year=${field}
605   done
606   echo ${year}
607   return 0
608 }
609
610 hostInfo(){
611 #
612 # Hallo world -  Print AliRoot/Root/Alien system info
613 #
614
615 #
616 # HOST info
617 #
618     echo --------------------------------------
619         echo 
620         echo HOSTINFO
621         echo 
622         echo HOSTINFO HOSTNAME"      "$HOSTNAME
623         echo HOSTINFO DATE"          "`date`
624         echo HOSTINFO gccpath"       "`which gcc` 
625         echo HOSTINFO gcc version"   "`gcc --version | grep gcc`
626         echo --------------------------------------    
627
628 #
629 # ROOT info
630 #
631         echo --------------------------------------
632         echo
633         echo ROOTINFO
634         echo 
635         echo ROOTINFO ROOT"           "`which root`
636         echo ROOTINFO VERSION"        "`root-config --version`
637         echo 
638         echo --------------------------------------
639
640
641 #
642 # ALIROOT info
643 #
644         echo --------------------------------------
645         echo
646         echo ALIROOTINFO
647         echo 
648         echo ALIROOTINFO ALIROOT"        "`which aliroot`
649         echo ALIROOTINFO VERSION"        "`echo $ALICE_LEVEL`
650         echo ALIROOTINFO TARGET"         "`echo $ALICE_TARGET`
651         echo 
652         echo --------------------------------------
653
654 #
655 # Alien info
656 #
657 #echo --------------------------------------
658 #echo
659 #echo ALIENINFO
660 #for a in `alien --printenv`; do echo ALIENINFO $a; done 
661 #echo
662 #echo --------------------------------------
663
664 #
665 # Local Info
666 #
667         echo PWD `pwd`
668         echo Dir 
669         ls -al
670         echo
671         echo
672         echo
673 }
674
675 main "$@"