1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
#!/bin/bash
# -*- shell-script -*-
########################################################################
# Create a system cache file
#
# This creates the system cache file for module spider.
########################################################################
########################################################################
# Site Specific Setting
########################################################################
LMOD_DIR=/opt/apps/lmod/lmod/libexec
BASE_MODULE_PATH=/opt/apps/xsede/modulefiles:/opt/apps/modulefiles:/opt/modulefiles
ADMIN_ls4="/home1/moduleData"
ADMIN_stampede="/home1/moduleData"
nlocal=$(hostname -f)
nlocal=${nlocal%.tacc.utexas.edu}
first=${nlocal%%.*}
SYSHOST=${nlocal#*.}
eval "ADMIN_DIR=\$ADMIN_$SYSHOST"
CacheDir=$ADMIN_DIR/cacheDir
RmapDir=$ADMIN_DIR/reverseMapD
########################################################################
# End Site Specific Setting
########################################################################
buildNewDB()
{
local DIR=$1
local file=$2
local option=$file
local OLD=$DIR/$file.old.lua
local NEW=$DIR/$file.new.lua
local RESULT=$DIR/$file.lua
rm -f $OLD $NEW
$LMOD_DIR/spider -o $option $BASE_MODULE_PATH > $NEW
if [ "$?" = 0 ]; then
chmod 644 $NEW
if [ -f $RESULT ]; then
cp $RESULT $OLD
fi
mv $NEW $RESULT
fi
}
ans=$(./may_i_build_cache -f $updateSystemFn -i ./clusterDescriptT.lua -c $CacheDir )
if [ "$ans" = yes ]; then
buildNewDB $CacheDir moduleT
fi
########################################################################
# Build reverse map (This is optional)
########################################################################
#buildNewDB $RmapDir reverseMapT
|