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
|
#!/bin/sh
#set -x
if [ $# -ne 1 ]; then
echo "Usage: mpjboot <machines_file>";
exit 127
fi
get_os()
{
returncode=0;
DIST_OS=`uname -s | tr [:upper:] [:lower:] | tr -d [:blank:]`
case "$DIST_OS" in
'sunos')
DIST_OS="solaris"
returncode=4;
;;
'hp-ux' | 'hp-ux64')
DIST_OS="hpux"
returncode=3;
;;
'darwin')
DIST_OS="macosx"
returncode=2;
;;
'unix_sv' | 'linux')
DIST_OS="unixware"
returncode=1;
;;
esac
return $returncode;
}
get_arch()
{
returncode=0;
DIST_ARCH=`uname -m | tr [:upper:] [:lower:] | tr -d [:blank:]`
case "$DIST_ARCH" in
'amd64' | 'athlon' | 'ia32' | 'ia64' | 'i386' | 'i486' | 'i586' | 'i686' )
DIST_ARCH="x86"
returncode=1;
;;
'x86_64')
DIST_ARCH="x86_64"
returncode=19;
;;
'ip27')
DIST_ARCH="mips"
returncode=5;
;;
'power' | 'powerpc' | 'power_pc' | 'ppc64')
DIST_ARCH="ppc"
returncode=2;
;;
'pa_risc' | 'pa-risc')
DIST_ARCH="parisc"
returncode=6;
;;
'sun4u' | 'sparcv9')
DIST_ARCH="sparc"
returncode=4;
;;
'9000/800')
DIST_ARCH="parisc"
returncode=3;
;;
esac
return $returncode;
}
port=`grep wrapper.app.parameter.2 $MPJ_HOME/conf/wrapper.conf |cut -d = -f2`
hosts=`cat $1`
for i in `echo $hosts`; do
host=`echo $i`
if java -cp .:$MPJ_HOME/lib/starter.jar runtime.starter.PortScan $host $port ; then
echo "mpjboot found port $port busy on $host machine. There are two possibilities:";
echo " (1) The daemon might already be running...";
echo " (2) If the daemon is not running, then set a different port by modifying the wrapper.app.parameter.2 property in the $MPJ_HOME/conf/wrapper.conf file.";
exit 128;
fi
done
get_arch
arch=`echo $?`;
get_os
os=`echo $?`;
eArch=`uname -m | tr [:upper:] [:lower:] | tr -d [:blank:]`;
eOs=`uname -s | tr [:upper:] [:lower:] | tr -d [:blank:]`;
lines=`cat $1`
count=0
for i in `echo $lines`; do
host=`echo $i`
# This means when Os = linux and Architecure = x86 32 Or AMD Or i386 etc
if [ $os -eq 1 ] && [ $arch -eq 1 ]; then
cd $MPJ_HOME/lib
cp libwrapper.so_linux_x86_32 libwrapper.so
ssh $host "cd $MPJ_HOME/bin;./mpjdaemon_linux_x86_32 start;"
# This means when Os = linux and Architecure = x86_64
elif [ $os -eq 1 ] && [ $arch -eq 19 ]; then
cd $MPJ_HOME/lib
cp libwrapper.so_linux_x86_64 libwrapper.so
ssh $host "cd $MPJ_HOME/bin;./mpjdaemon_linux_x86_64 start;"
# This means when Os = linux and Architecure = ppc
elif [ $os -eq 1 ] && [ $arch -eq 2 ]; then
cd $MPJ_HOME/lib
cp libwrapper.so_linux_ppc_64 libwrapper.so
ssh $host "cd $MPJ_HOME/bin;./mpjdaemon_linux_ppc_64 start;"
# This means when Os =Solaris and Architecure = x86 32 Or 64 Or AMD Or i386 etc
elif [ $os -eq 4 ] && [ $arch -eq 1 ]; then
cd $MPJ_HOME/lib
cp libwrapper.so_linux_x86_32 libwrapper.so
ssh $host "cd $MPJ_HOME/bin;./mpjdaemon_linux_x86_32 start;"
# This means when Os = Solaris and Architecure = Sparc
elif [ $os -eq 4 ] && [ $arch -eq 4 ]; then
cd $MPJ_HOME/lib
cp libwrapper.so_solaris_sparc_64 libwrapper.so
ssh $host "cd $MPJ_HOME/bin;./mpjdaemon_solaris_sparc_64 start;"
# This means when Os = Mac (works for both darwin-x86 and darwin-ppc
# Credit: Ed Baskerville (ebaskerv@umich.edu) for identifying and proposing
# a fix for this elif
elif [ $os -eq 2 ]; then
cd $MPJ_HOME/lib
cp libwrapper.jnilib_macosx libwrapper.jnilib
ssh $host "cd $MPJ_HOME/bin;./mpjdaemon_macosx start;"
elif [ $os -eq 0 ] || [ $arch -eq 0 ]; then
echo -e "MPJ Express runtime is not supported on your platform. Please contact \e[4maamir.shafi@seecs.edu.pk\e[0m how to execute MPJ Express on \e[4m$eArch\e[0m running \e[4m$eOs\e[0m";
break;
fi
count=`expr $count + 1`
done
|