Commit a1bb7240 authored by Andrea Sciaba's avatar Andrea Sciaba
Browse files

Added some glidein checks

parent 43650852
......@@ -11,15 +11,43 @@
# - prints the type and version of middleware
# - the required version of lcg-cp is installed
# String exit codes:
# NO_CERT_DIR: did not find the X.509 certificate directory
# NO_PROXY: did not find the proxy
# CANT_CREATE_DIR: cannot create a subdirectory
# NO_COPY_PROXY: cannot copy proxy in subdirectory
# SW_DIR_UNDEF: location of CMS software directory undefined
# SW_DIR_NOT_READABLE: CMS software directory not existent or unreadable
# SW_DIR_NOT_WRITABLE: the CMS software area is not writable when it should
# WORKDIR_LOW_SPACE: less than 10 GB of free spae in working directory
# TMP_LOW_SPACE: less than 10 MB space in /tmp
# TMP_LOW_QUOTA: less than 10 GB of free quota
# LCG_CP_MISSING: the lcg-cp command is not in the PATH
# STAGEOUT_CMD_INVALID: the version of the stageout command is too old
# OK: everything is OK
export LANG=C
function check_df {
dir=$1
free=`df -P -B1MB $dir | awk '{if (NR==2) print $4}'`
echo $free
return 0
}
function check_quota {
dir=$1
fs=`df -kP $dir | awk '{if (NR==2) print $1}'`
myquotastr=`quota 2>/dev/null | awk '{if (NR>2) {if (NF==1) {n=$1; getline; print n " " $2-$1} else {print $1 " " $3-$2}}}' |grep $fs`
if [ $? -eq 0 ]; then
# check only if there are any quotas, else ignore
myquota=`echo $myquotastr|awk '{print $2}'`
let "quotagb=$myquota / (2 * 1000)"
echo $quotagb
fi
echo -1
return 0
}
echo "Printing preliminary information..."
echo
echo "Sysinfo: "
......@@ -32,19 +60,65 @@ echo -n "UTCDate: "
date --utc
echo -n "UserId: "
id
cat /proc/meminfo | grep Mem
# Checking some X509 details
if [ -e "$X509_CERT_DIR" ]; then
cert_dir=$X509_CERT_DIR
elif [ -e "$HOME/.globus/certificates/" ]; then
cert_dir=$HOME/.globus/certificates/
elif [ -e "/etc/grid-security/certificates/" ]; then
cert_dir=/etc/grid-security/certificates/
else
echo "ERROR: could not find X509 certificate directory"
echo "summary: NO_CERT_DIR"
exit $SAME_ERROR
fi
echo "CertDir: $cert_dir"
if [ -a "$X509_USER_PROXY" ]; then
proxy=$X509_USER_PROXY
else
echo "ERROR: could not find X509 proxy certificate"
echo "summary: NO_PROXY"
exit $SAME_ERROR
fi
echo "Proxy: $proxy"
# Check proxy copy as in glidein pilots
local_proxy_dir=`pwd`/ticket
mkdir $local_proxy_dir
if [ $? -ne 0 ]; then
echo "ERROR: could not find create $local_proxy_dir"
echo "summary: CANT_CREATE_DIR"
exit $SAME_ERROR
fi
cp $X509_USER_PROXY $local_proxy_dir/myproxy
if [ $? -ne 0 ]; then
echo "ERROR: could not copy proxy $X509_USER_PROXY"
echo "summary: NO_COPY_PROXY"
exit $SAME_ERROR
fi
rm -rf $local_proxy_dir
type -t voms-proxy-info > /dev/null
result=$?
if [ $result -eq 0 ] ; then
isvoms=1
echo -n "UserDN: "
voms-proxy-info -identity
echo -n "Timeleft: "
voms-proxy-info -timeleft
l=`voms-proxy-info -timeleft`
echo "Timeleft: $l s"
fqan=`voms-proxy-info -fqan`
echo "FQAN: $fqan"
echo "FQAN:"
echo "$fqan"
else
isvoms=0
echo "WARNING: voms-proxy-info not found"
fi
cat /proc/meminfo | grep Mem
if [ $isvoms -eq 1 -a $l -lt 21600 ] ; then
echo "WARNING: proxy shorther than 6 hours"
fi
# Test of the local worker node environment
echo
......@@ -86,14 +160,14 @@ fi
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 }'`
SPACE=`fs lq $SW_DIR | tail -1 | awk '{print (\$2-\$3)/1000000 }'`
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}'`
SPACE=`df -k -P $SW_DIR | tail -1 | awk '{print \$4/1000000}'`
fi
if [ $hasCVMFS == 0 ]; then
echo "FreeSWAreaSpace: $SPACE MB"
echo "FreeSWAreaSpace: $SPACE GB"
fi
# Test if we are at CERN
......@@ -116,6 +190,34 @@ if [ -d $SW_DIR ] ; then
fi
fi
# Check for free space on current directory and /tmp
space=`check_df .`
echo "WorkDirSpace: $space MB"
if [ $space -lt 10000 ] ; then
echo "ERROR: less than 10 GB of free space in working directory ."
echo "summary: WORKDIR_LOW_SPACE"
exit $SAME_ERROR
fi
space=`check_df /tmp`
echo "TmpSpace: $space MB"
if [ $space -lt 10 ] ; then
echo "ERROR: less than 10 MB of free space in /tmp"
echo "summary: TMP_LOW_SPACE"
exit $SAME_ERROR
fi
# Check quota, if any
space=`check_quota .`
if [ $space -ne -1 ] ; then
echo "Quota: $space MB"
if [ $space -lt 10000 ] ; then
echo "ERROR: too little quota"
echo "summary: TMP_LOW_QUOTA"
exit $SAME_ERROR
fi
fi
# check for SL5
echo
echo "Checking OS version from $SW_DIR/common/cmsos and architecture from $SW_DIR/common/cmsarch..."
......
Supports Markdown
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