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 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
|
#!/bin/sh
#
# create Grid Engine settings.[c]sh file
#
#___INFO__MARK_BEGIN__
##########################################################################
#
# The Contents of this file are made available subject to the terms of
# the Sun Industry Standards Source License Version 1.2
#
# Sun Microsystems Inc., March, 2001
#
#
# Sun Industry Standards Source License Version 1.2
# =================================================
# The contents of this file are subject to the Sun Industry Standards
# Source License Version 1.2 (the "License"); You may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
#
# Software provided under this License is provided on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
# See the License for the specific provisions governing your rights and
# obligations concerning the Software.
#
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
#
# Copyright: 2001 by Sun Microsystems, Inc.
#
# All Rights Reserved.
#
##########################################################################
#___INFO__MARK_END__
#
# $1 = base directory where settings.[c]sh is created
PATH=/bin:/usr/bin
ErrUsage()
{
echo
echo "usage: `basename $0` outdir"
echo " \$SGE_ROOT must be set"
echo " \$SGE_CELL, \$SGE_QMASTER_PORT and \$SGE_EXECD_PORT must be set if used in your environment"
echo " \$SGE_CLUSTER_NAME must be set or \$SGE_ROOT and \$SGE_CELL must be set"
exit 1
}
if [ $# != 1 ]; then
ErrUsage
fi
if [ -z "$SGE_ROOT" -o -z "$SGE_CELL" ]; then
ErrUsage
fi
SP_CSH=$1/settings.csh
SP_SH=$1/settings.sh
#
# C shell settings file
#
echo "setenv SGE_ROOT $SGE_ROOT" > $SP_CSH
echo "" >> $SP_CSH
echo "set ARCH = \`\$SGE_ROOT/util/arch\`" >> $SP_CSH
echo "set DEFAULTMANPATH = \`\$SGE_ROOT/util/arch -m\`" >> $SP_CSH
echo "set MANTYPE = \`\$SGE_ROOT/util/arch -mt\`" >> $SP_CSH
echo "" >> $SP_CSH
#if [ "$SGE_CELL" != "" -a "$SGE_CELL" != "default" ]; then
echo "setenv SGE_CELL $SGE_CELL" >> $SP_CSH
#else
# echo "unsetenv SGE_CELL" >> $SP_CSH
#fi
echo "setenv SGE_CLUSTER_NAME `cat $SGE_ROOT/$SGE_CELL/common/cluster_name 2>/dev/null`" >> $SP_CSH
if [ "$SGE_QMASTER_PORT" != "" ]; then
echo "setenv SGE_QMASTER_PORT $SGE_QMASTER_PORT" >> $SP_CSH
else
echo "unsetenv SGE_QMASTER_PORT" >> $SP_CSH
fi
if [ "$SGE_EXECD_PORT" != "" ]; then
echo "setenv SGE_EXECD_PORT $SGE_EXECD_PORT" >> $SP_CSH
else
echo "unsetenv SGE_EXECD_PORT" >> $SP_CSH
fi
echo "" >> $SP_CSH
echo '# library path setting required only for architectures where RUNPATH is not supported' >> $SP_CSH
echo 'if ( $?MANPATH == 1 ) then' >> $SP_CSH
echo " setenv MANPATH \$SGE_ROOT/"'${MANTYPE}':'$MANPATH' >> $SP_CSH
echo "else" >> $SP_CSH
echo " setenv MANPATH \$SGE_ROOT/"'${MANTYPE}:$DEFAULTMANPATH' >> $SP_CSH
echo "endif" >> $SP_CSH
echo "" >> $SP_CSH
echo "set path = ( \$SGE_ROOT/bin/"'$ARCH $path )' >> $SP_CSH
echo 'switch ($ARCH)' >> $SP_CSH
#ENFORCE_SHLIBPATH#echo 'case "sol*":' >> $SP_CSH
#ENFORCE_SHLIBPATH#echo 'case "lx*":' >> $SP_CSH
#ENFORCE_SHLIBPATH#echo 'case "hp11-64":' >> $SP_CSH
#ENFORCE_SHLIBPATH#echo ' breaksw' >> $SP_CSH
echo 'case "*":' >> $SP_CSH
echo " set shlib_path_name = \`\$SGE_ROOT/util/arch -lib\`" >> $SP_CSH
echo " if ( \`eval echo '\$?'\$shlib_path_name\` ) then" >> $SP_CSH
echo " set old_value = \`eval echo '\$'\$shlib_path_name\`" >> $SP_CSH
echo " setenv \$shlib_path_name \"\$SGE_ROOT/lib/\$ARCH\":\"\$old_value\"" >> $SP_CSH
echo " else" >> $SP_CSH
echo " setenv \$shlib_path_name \$SGE_ROOT/lib/\$ARCH" >> $SP_CSH
echo " endif" >> $SP_CSH
echo " unset shlib_path_name old_value" >> $SP_CSH
echo "endsw" >> $SP_CSH
echo "unset ARCH DEFAULTMANPATH MANTYPE" >> $SP_CSH
#
# bourne shell settings file
#
echo "SGE_ROOT=$SGE_ROOT; export SGE_ROOT" > $SP_SH
echo "" >> $SP_SH
echo "ARCH=\`\$SGE_ROOT/util/arch\`" >> $SP_SH
echo "DEFAULTMANPATH=\`\$SGE_ROOT/util/arch -m\`" >> $SP_SH
echo "MANTYPE=\`\$SGE_ROOT/util/arch -mt\`" >> $SP_SH
echo "" >> $SP_SH
if [ "$SGE_CELL" != "" ]; then
echo "SGE_CELL=$SGE_CELL; export SGE_CELL" >> $SP_SH
else
echo "unset SGE_CELL" >> $SP_SH
fi
echo "SGE_CLUSTER_NAME=`cat $SGE_ROOT/$SGE_CELL/common/cluster_name 2>/dev/null`; export SGE_CLUSTER_NAME" >> $SP_SH
if [ "$SGE_QMASTER_PORT" != "" ]; then
echo "SGE_QMASTER_PORT=$SGE_QMASTER_PORT; export SGE_QMASTER_PORT" >> $SP_SH
else
echo "unset SGE_QMASTER_PORT" >> $SP_SH
fi
if [ "$SGE_EXECD_PORT" != "" ]; then
echo "SGE_EXECD_PORT=$SGE_EXECD_PORT; export SGE_EXECD_PORT" >> $SP_SH
else
echo "unset SGE_EXECD_PORT" >> $SP_SH
fi
echo "" >> $SP_SH
echo "if [ \"\$MANPATH\" = \"\" ]; then" >> $SP_SH
echo " MANPATH=\$DEFAULTMANPATH" >> $SP_SH
echo "fi" >> $SP_SH
echo "MANPATH=\$SGE_ROOT/\$MANTYPE:\$MANPATH; export MANPATH" >> $SP_SH
echo "" >> $SP_SH
echo "PATH=\$SGE_ROOT/bin/\$ARCH:\$PATH; export PATH" >> $SP_SH
echo '# library path setting required only for architectures where RUNPATH is not supported' >> $SP_SH
echo 'case $ARCH in' >> $SP_SH
#ENFORCE_SHLIBPATH#echo 'sol*|lx*|hp11-64)' >> $SP_SH
#ENFORCE_SHLIBPATH#echo ' ;;' >> $SP_SH
echo '*)' >> $SP_SH
echo " shlib_path_name=\`\$SGE_ROOT/util/arch -lib\`" >> $SP_SH
echo " old_value=\`eval echo '\$'\$shlib_path_name\`" >> $SP_SH
echo " if [ x\$old_value = "x" ]; then" >> $SP_SH
echo " eval \$shlib_path_name=\$SGE_ROOT/lib/\$ARCH" >> $SP_SH
echo " else" >> $SP_SH
echo " eval \$shlib_path_name=\$SGE_ROOT/lib/\$ARCH:\$old_value" >> $SP_SH
echo " fi" >> $SP_SH
echo " export \$shlib_path_name" >> $SP_SH
echo ' unset shlib_path_name old_value' >> $SP_SH
echo ' ;;' >> $SP_SH
echo 'esac' >> $SP_SH
echo "unset ARCH DEFAULTMANPATH MANTYPE" >> $SP_SH
|