diff --git a/check_modules.sh b/check_modules.sh index 6708c9b..90f31ec 100755 --- a/check_modules.sh +++ b/check_modules.sh @@ -1,9 +1,9 @@ #!/bin/bash -l # -# Christoph Niethammer , (c) 2012 +# Copyright (c) 2012-2015 Christoph Niethammer # # Script checking the module environment for problems during module loading/unloading -# +# # Usage: # check_modules.sh [MODULE] # @@ -11,10 +11,10 @@ # MODULE May be any valid module path as used for 'module avail [MODULE]' # -# Command line options: -moduleclass=$1 # check only subset of modules +# Command line options: +moduleclass=$1 # check only subset of modules -# definitions for esear color output to display +# definitions for esear color output to display Color_Off='\e[0m' # Text Reset IGreen='\e[0;92m' # Intense Green IRed='\e[0;91m' # Intense Red @@ -24,7 +24,7 @@ LOGDIR=${LOGDIR:=$PWD} tmpdir=/tmp/check_modules-$USER mkdir -p $tmpdir logfile="$LOGDIR/check_modules.log" # logfile with detailed information -module_load_logfile="$tmpdir/.module_load.log" # output of 'module load commands +module_load_logfile="$tmpdir/.module_load.log" # output of 'module load commands module_rm_logfile="$tmpdir/.module_rm.log" # output of 'module rm' commands module_clean_env_file="$tmpdir/.module_clean_env" # original environment @@ -51,17 +51,17 @@ echo "--------------------" >> $logfile for m_original in $(module av -t $moduleclass 2>&1); do if [[ $m_original =~ ^[A-Za-z] ]]; then # skip any non module line in output m=$(echo $m_original | sed -e 's/(.*)//') # Remove aliases e.g. (default) - echo -n "Checking $m_original ... " + echo -n "Checking $m_original ... " echo "Checking $m_original ... " >> $logfile cmd="module load $m" echo $cmd >> $logfile - $cmd > $module_load_logfile 2>&1 + $cmd > $module_load_logfile 2>&1 cat $module_load_logfile >> $logfile module li >>$logfile 2>&1 # check if module was loaded and did not report errors during loading - if module li -t 2>&1 | grep $m >/dev/null && ! grep ERROR $module_load_logfile >/dev/null ; then + if module li -t 2>&1 | grep $m >/dev/null && ! grep ERROR $module_load_logfile >/dev/null ; then cmd="module rm $m" echo $cmd >> $logfile @@ -79,7 +79,7 @@ for m_original in $(module av -t $moduleclass 2>&1); do echo "SUCCESS" >> $logfile fi - else + else echo -e "${IRed}loading failed${Color_Off}" echo "ERROR: loading module '$m' failed" >> $logfile failed_modules=(${failed_modules[@]} $m) @@ -104,7 +104,7 @@ for m_original in $(module av -t $moduleclass 2>&1); do fi done -# clean up file storing the initial environment +# clean up file storing the initial environment rm -f $module_clean_env_file rm -rf $tmpdir diff --git a/check_permissions.sh b/check_permissions.sh index fe9ee19..e491098 100755 --- a/check_permissions.sh +++ b/check_permissions.sh @@ -2,8 +2,8 @@ # # Script checking the right permissions for software installations: # Ordinary files must at least have permissions 664 and directories 755. -# -# Christoph Niethammer (C) 2010-2012 +# +# Copyright (c) 2010-2015 Christoph Niethammer # declare -r APP_NAME="${0##*/}" @@ -33,7 +33,7 @@ Usage: $APP_NAME DIR -v, --verbose Be more verbose (print list of found directories and files) --fixit Fix permissions if possible (only working in verbose mode) -Checks permissions in the given directories. Permissions for files must be +Checks permissions in the given directories. Permissions for files must be at least set to 664 and for directories must be exactly 775. EOF @@ -57,7 +57,7 @@ if [ $# -lt 1 ]; then exit 0 fi -for arg in $@; do +for arg in $@; do case $arg in --fixit) FIX_PERMISSIONS=1 @@ -88,9 +88,9 @@ for arg in $@; do esac done -echo "# Searching for directories which do not match '$DIR_PERMS' ..." +echo "# Searching for directories which do not match '$DIR_PERMS' ..." WRONG_DIRS=(`find $SEARCH_DIRS -type d ! -perm $DIR_PERMS -print`) -echo "# Searching for files which do not match at least '$FILE_PERMS' ..." +echo "# Searching for files which do not match at least '$FILE_PERMS' ..." WRONG_FILES=(`find $SEARCH_DIRS -type f ! -perm -$FILE_PERMS -print`) diff --git a/module_stats.py b/module_stats.py index 4bde81f..8da053a 100755 --- a/module_stats.py +++ b/module_stats.py @@ -1,6 +1,6 @@ #!/usr/bin/env python2.6 # -# Copyright(c) 2013 Christoph Niethammer +# Copyright(c) 2013-2015 Christoph Niethammer # import os @@ -76,7 +76,7 @@ for logfilename in os.listdir(logdir) : moduleusers[module][user] = moduleusers[module][user] + 1 # if ' swap' in line : # print line.split() - + print "-"*78 print "Module statistics for " + startdate.strftime('%Y-%m-%d') + " - " + enddate.strftime('%Y-%m-%d') print "-"*78