#!/bin/bash echo "

Stage out test for the Monte Carlo production

" echo "

Preliminary checks

" echo "
"
set -x
uname -a
date
id
#env | grep -v '^NAGIOS'
set +x
echo "
" # Source the CMS environment echo "

Sourcing the CMS environment

" export SCRAM_ARCH=slc5_amd64_gcc462 if [ -n "$OSG_APP" ] ; then echo "

This is an OSG site

" SW_DIR=$OSG_APP/cmssoft/cms source $OSG_GRID/setup.sh result=$? elif [ -n "$VO_CMS_SW_DIR" ] ; then echo "

This is an LCG site

" SW_DIR=$VO_CMS_SW_DIR result=$? else echo "

ERROR: neither VO_CMS_SW_DIR nor OSG_APP defined

" exit $SAME_ERROR fi echo "
"
source $SW_DIR/cmsset_default.sh
result=$(expr $? + $result)
echo "
" if [ $result != 0 ] then echo "

ERROR: $VO_CMS_SW_DIR/cmsset_default.sh non existent or non readable

" exit $SAME_ERROR fi echo "WMAgent thinks it found the correct CMSSW setup script" if [ -e $VO_CMS_SW_DIR/COMP/slc5_amd64_gcc434/external/python/2.6.4/etc/profile.d/init.sh ] then . $VO_CMS_SW_DIR/COMP/slc5_amd64_gcc434/external/python/2.6.4/etc/profile.d/init.sh export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$VO_CMS_SW_DIR/COMP/slc5_amd64_gcc434/external/openssl/0.9.7m/lib:$VO_CMS_SW_DIR/COMP/slc5_amd64_gcc434/external/bz2lib/1.0.5/lib elif [ -e $OSG_APP/cmssoft/cms/COMP/slc5_amd64_gcc434/external/python/2.6.4/etc/profile.d/init.sh ] then . $OSG_APP/cmssoft/cms/COMP/slc5_amd64_gcc434/external/python/2.6.4/etc/profile.d/init.sh export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OSG_APP/cmssoft/cms/COMP/slc5_amd64_gcc434/external/openssl/0.9.7m/lib:$OSG_APP/cmssoft/cms/COMP/slc5_amd64_gcc434/external/bz2lib/1.0.5/lib fi command -v python2.6 > /dev/null rc=$? if [[ $rc != 0 ]] then echo "WMAgent Error: Python2.6 isn't available on this worker node." >&2 echo "WMAgent Error: WMCore/WMAgent REQUIRES python2.6" >&2 exit 3 else echo "WMAgent found python2.6 at.." echo `which python2.6` fi export PYTHONPATH=$SAME_SENSOR_HOME/cms-MC-test/lib/python2.6/site-packages:$PYTHONPATH echo "

Checking PYTHONPATH

" echo "
"
echo "PYTHONPATH=$PYTHONPATH"
echo "
" echo "

Invoking site test

" echo "
"
echo "USER/WHOAMI?:" $USER/`whoami`
echo "USER ID:" $UID
voms-proxy-info -all
echo "
" cd $SAME_SENSOR_HOME/cms-MC-test/ if [ $? -ne 0 ]; then echo "

ERROR: Could not access the cms-MC-test directory

" exit $SAME_ERROR else echo "
"
  chmod u+x RuntimeSAMStageOut.py 
  ./RuntimeSAMStageOut.py | sed -e 's/&/&/g' | sed -e 's//\>/g' 2>&1
  EXIT_STATUS=$?
fi
echo "
" if [ $EXIT_STATUS -ne 0 -a $EXIT_STATUS -ne 4 ] ; then echo "

ERROR: Stage Out Test failed: $EXIT_STATUS

" exit $SAME_ERROR elif [ $EXIT_STATUS -eq 4 ]; then echo "

WARNING: Stage Out Test failed to cleanup the test file: $EXIT_STATUS

" exit $SAME_WARNING else echo "

Stage Out Test successful

" exit $SAME_OK fi