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