Major improvements to the module load check script.
* Fixes problems with alias names of modules * Increased performance * Summary of failed modules
This commit is contained in:
parent
68b57e26c4
commit
983d9b5708
1 changed files with 32 additions and 8 deletions
|
@ -1,17 +1,41 @@
|
||||||
#!/bin/bash -l
|
#!/bin/bash -l
|
||||||
|
#
|
||||||
|
# Christoph Niethammer <niethammer@hlrs.de>, (c) 2012
|
||||||
|
#
|
||||||
|
# TODO:
|
||||||
|
# - check for proper module unloading
|
||||||
|
#
|
||||||
|
|
||||||
|
failed_modules=()
|
||||||
|
|
||||||
for m in $(module av 2>&1); do
|
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
|
||||||
if [[ $m =~ ^[A-Za-z] ]]; then
|
if [[ $m =~ ^[A-Za-z] ]]; then
|
||||||
module load $m >.module_load.log 2>&1
|
m=$(echo $m | sed -e 's/(.*)//')
|
||||||
if ! module li 2>&1 | grep $m >/dev/null; then
|
echo -n "Checking $m ... " | tee -a $logfile
|
||||||
echo "ERROR: Module $m failed to load"
|
module load $m > $module_load_logfile 2>&1
|
||||||
fi
|
# check if module was loaded
|
||||||
if grep -i "error" ".module_load.log" >/dev/null; then
|
if module li 2>&1 | grep $m > /dev/null; then
|
||||||
echo "ERROR: Module $m reported errors when loading:"
|
echo "success" | tee -a $logfile
|
||||||
awk '{print " " $0;}' .module_load.log
|
else
|
||||||
|
echo "failed" | tee -a $logfile
|
||||||
|
failed_modules=(${failed_modules[@]} $m)
|
||||||
|
cat .module_load.log | tee -a $logfile
|
||||||
fi
|
fi
|
||||||
module purge 2>/dev/null
|
module purge 2>/dev/null
|
||||||
|
rm -f $module_load_logfile
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo "----------------------------------------"
|
||||||
|
echo "Summary of failed modules:"
|
||||||
|
echo "----------------------------------------"
|
||||||
|
for m in ${failed_modules[@]}; do
|
||||||
|
echo "$m"
|
||||||
|
done
|
||||||
|
echo "----------------------------------------"
|
||||||
|
|
Loading…
Reference in a new issue