Commit 8c37eacb authored by Andrea Sciaba's avatar Andrea Sciaba
Browse files

First version

parent a5bce753
#!/bin/bash
#
# CE-cms-env
#
# This test does the following things:
# - prints some preliminary information
# - checks that the WN complies with some CMS requirements
# - checks that a software area is defined and exists
# - checks that the software area is writable with the lcgadmin role,
# if the siteis not CERN and is not using CERNVM-FS
# - prints the type and version of middleware
# - the required version of lcg-cp is installed
export LANG=C
echo "Printing preliminary information..."
echo
echo "Sysinfo: "
uname -a
echo "Issue: "
cat /etc/issue
echo -n "LocalDate: "
date
echo -n "UTCDate: "
date --utc
echo -n "UserId: "
id
type -t voms-proxy-info > /dev/null
result=$?
if [ $result -eq 0 ] ; then
echo -n "UserDN: "
voms-proxy-info -identity
echo -n "Timeleft: "
voms-proxy-info -timeleft
fqan=`voms-proxy-info -fqan`
echo "FQAN: $fqan"
else
echo "WARNING: voms-proxy-info not found"
fi
cat /proc/meminfo | grep Mem
# Test of the local worker node environment
echo
echo "Checking local worker node environment..."
echo
# Software area definition and existence
isEGEE=0
if [ -n "$OSG_APP" ] ; then
SW_DIR=$OSG_APP/cmssoft/cms
[ -f $OSG_GRID/setup.sh ] && source $OSG_GRID/setup.sh
echo "SwArea: $SW_DIR"
elif [ -n "$VO_CMS_SW_DIR" ] ; then
isEGEE=1
SW_DIR=$VO_CMS_SW_DIR
echo "SwArea: $SW_DIR"
else
echo "ERROR: Neither VO_CMS_SW_DIR nor OSG_APP defined"
echo "summary: SW_DIR_UNDEF"
exit $SAME_ERROR
fi
if [ ! -d $SW_DIR ] ; then
echo "ERROR: software directory non existent or non readable"
echo "summary: SW_DIR_NOT_READABLE"
exit $SAME_ERROR
fi
# Software area space
hasCVMFS=0
if [ -d $SW_DIR ] ; then
if [ "`echo $SW_DIR | cut -d / -f 2`" == "afs" ]; then
SPACE=`fs lq $SW_DIR | tail -1 | awk '{print (\$2-\$3)/1024 }'`
elif [ "`echo $SW_DIR | cut -d / -f 2`" == "cvmfs" ]; then
hasCVMFS=1
else
SPACE=`df -k -P $SW_DIR | tail -1 | awk '{print \$4/1024}'`
fi
if [ $hasCVMFS == 0 ]; then
echo "FreeSWAreaSpace: $SPACE MB"
fi
# Test if we are at CERN
atCERN=0
atCERN=`echo $SW_DIR | grep -c cern.ch 2>/dev/null`
# Test if can write on SwArea (for EGI, non-CVMFS sites excluding CERN)
cantwrite=0
if [ $isEGEE == 1 ] && [ $hasCVMFS == 0 ] && [ $atCERN == 0 ]
then
touch $SW_DIR/.sametest
result=$?
if [ $result != 0 ]
then
cantwrite=1
echo "ERROR: cannot write to software area"
echo "summary: SW_DIR_NOT_WRITABLE"
exit $SAME_ERROR
fi
fi
fi
echo
echo "Checking middleware installation..."
echo
type="unknown"
mwver='unknown'
if type -f glite-version > /dev/null; then
type="gLite"
mwver=`glite-version`
elif [ -f /etc/emi-version ] ; then
type="EMI"
mwver=`cat /etc/emi-version`
elif type -f lcg-version > /dev/null; then
type="LCG"
mwver=`lcg-version`
fi
echo "Middleware: $type $mwver"
type -t lcg-cp > /dev/null
result=$?
if [ $result -ne 0 ] ; then
echo "ERROR: lcg-cp not in the PATH"
echo "summary: LCG_CP_MISSING"
exit $SAME_ERROR
else
lcgutilver=`lcg-cp --version | grep lcg_util | sed 's/lcg_util-//'`
echo "lcg_util: $lcgutilver"
gfalver=`lcg-cp --version | grep GFAL-client | sed 's/GFAL-client-//'`
echo "GFAL-client: $gfalver"
lver=(`echo $lcgutilver | awk -F . '{print $1*10000+$2*100+$3}'`)
echo -n "Minimum version of lcg-cp: 1.6.7... "
if [ $lver -ge 10607 ] ; then
echo "OK"
else
echo
echo "ERROR: No validated command for remote stageout available"
echo "summary: STGOUT_CMD_INVALID"
exit $SAME_ERROR
fi
fi
echo
echo "All checks OK"
echo "summary: OK"
exit $SAME_OK
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment