2012-06-05 10:26:41 +00:00
|
|
|
#!/bin/bash -l
|
2012-07-02 10:01:26 +00:00
|
|
|
#
|
|
|
|
# Christoph Niethammer <niethammer@hlrs.de>, (c) 2012
|
|
|
|
#
|
|
|
|
# TODO:
|
|
|
|
# - check for proper module unloading
|
|
|
|
#
|
2012-06-05 10:26:41 +00:00
|
|
|
|
2012-07-02 10:01:26 +00:00
|
|
|
failed_modules=()
|
2012-06-05 10:26:41 +00:00
|
|
|
|
2012-07-02 10:01:26 +00:00
|
|
|
TMP=${TMP:=/tmp}
|
|
|
|
logfile="check_modules.log"
|
|
|
|
module_load_logfile="$TMP/.module_load.log"
|
|
|
|
|
|
|
|
echo "Module environment check, $(date)" | tee $logfile
|
|
|
|
|
|
|
|
for m in $(module av -t 2>&1); do
|
2012-06-05 10:26:41 +00:00
|
|
|
if [[ $m =~ ^[A-Za-z] ]]; then
|
2012-07-02 10:01:26 +00:00
|
|
|
m=$(echo $m | sed -e 's/(.*)//')
|
|
|
|
echo -n "Checking $m ... " | tee -a $logfile
|
|
|
|
module load $m > $module_load_logfile 2>&1
|
|
|
|
# check if module was loaded
|
|
|
|
if module li 2>&1 | grep $m > /dev/null; then
|
|
|
|
echo "success" | tee -a $logfile
|
|
|
|
else
|
|
|
|
echo "failed" | tee -a $logfile
|
|
|
|
failed_modules=(${failed_modules[@]} $m)
|
|
|
|
cat .module_load.log | tee -a $logfile
|
2012-06-05 10:26:41 +00:00
|
|
|
fi
|
|
|
|
module purge 2>/dev/null
|
2012-07-02 10:01:26 +00:00
|
|
|
rm -f $module_load_logfile
|
2012-06-05 10:26:41 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2012-07-02 10:01:26 +00:00
|
|
|
echo "----------------------------------------"
|
|
|
|
echo "Summary of failed modules:"
|
|
|
|
echo "----------------------------------------"
|
|
|
|
for m in ${failed_modules[@]}; do
|
|
|
|
echo "$m"
|
|
|
|
done
|
|
|
|
echo "----------------------------------------"
|