#!/bin/sh #/***************************************************************************** # * # * ldadjavaA.install # * # * # * DESCRIPTION # * Script for installing LDAD Web Dissem software on the external server # * # * This script assumes that LDAD has already been installed on LS # * using externalLDAD.install. # * # * USAGE: ldadjavaA.install LLL TTTXTTT # * where: LLL is the site ID # * TTTXTTT is the time zone in format: EST5EDT # * As ldad # * # * HISTORY # * June 15, 1999 CVS Creation. # * # * # ***************************************************************************** echo "`date` : BEGINNING EXTERNAL LDADJAVA INSTALL" #Usage USAGE="Usage: $0 \n\neg: $0 testwww /data/ldad/ldadjavaA.tar\n" #Get Arguments webSite=$1 if [ $# -ne 2 ] then echo "\n\nBad Arguments....." echo "$USAGE\n" exit 2 fi STAGING=/data/ldad TARFILE1=$2 LDAD_HOME=/ldad LDAD_EXTERNAL_LOGDIR=/data/logs/ldad export LDAD_EXTERNAL_DATA=/data/ldad export LDAD_EXTERNAL_HOME=/ldad # HOSTNAME is the hostname minus the domain name. HOSTNAME=`hostname | awk -F. '{print $1}'` # SITE_IDENTIFIER is the site hostname suffix SITE_IDENTIFIER=`echo $HOSTNAME | awk -F- '{print $2}'` DATE=`date "+%m%d%y"` SAVEDTAR="/data/ldad/LDADJAVA-$webSite-${DATE}.tar" TARLOG="/data/logs/ldad/ldadtar-$webSite.out" #Provide user some info and a chance to cancel if [ -a `tty` ] then echo " You are Installing in the $1 WebSite\n" echo " Note: In addition to updating the wkspace" echo " and jar file of the $webSite, you will be also updating" echo " the classes directories in order to keep the hmIngest " echo " and the jar files consistant.\n\n" echo " You can always go back by untarring the backup tar file\n" echo " - $SAVEDTAR" echo "Do you want to continue y/n" read continue if [ "$continue" != "y" -a "$continue" != "Y" ] then echo "Exiting... No Changes have been made..." exit 1 fi fi if [ "`whoami`" != "ldad" ] then echo "This must be run as ldad and assumes system files are correct." exit 2 fi #if [ "`hostname`" != "ls1-${SITE_IDENTIFIER}" ] # then # echo "This script will only run on ls1-${SITE_IDENTIFIER}" # exit 3 #fi if [ ! -e ${TARFILE1} ] then echo "Tar file, ${TARFILE1}, not found..." exit 2 fi #echo "Tarfile ${TARFILE1} has been found" #exit echo "Saving OLD LDADJAVA FILES to a tar file ${SAVEDTAR} see ${TARLOG}" cd / tar -cvf ${SAVEDTAR} ldad/classes >${TARLOG} 2>&1 tar -rvf ${SAVEDTAR} ldad/bin/hmingestd.class >>${TARLOG} 2>&1 tar -rvf ${SAVEDTAR} ldad/data/scale >>${TARLOG} 2>&1 tar -rvf ${SAVEDTAR} ldad/data/factor >>${TARLOG} 2>&1 tar -rvf ${SAVEDTAR} ldad/data/ingest>>${TARLOG} 2>&1 tar -rvf ${SAVEDTAR} ldad/data/logconf.ini>>${TARLOG} 2>&1 tar -rvf ${SAVEDTAR} ldad/data/pollForData.conf>>${TARLOG} 2>&1 tar -rvf ${SAVEDTAR} ldad/bin/pollForData.pl>>${TARLOG} 2>&1 tar -rvhf ${SAVEDTAR} data/ldad/$webSite/htdocs/wkspace >>${TARLOG} 2>&1 tar -rvhf ${SAVEDTAR} data/ldad/$webSite/display0.jar >>${TARLOG} 2>&1 tar -rvhf ${SAVEDTAR} data/ldad/$webSite/display1.jar >>${TARLOG} 2>&1 tar -rvhf ${SAVEDTAR} data/ldad/$webSite/ptolemy.plot.jar >>${TARLOG} 2>&1 #Change permissions chmod -R 755 /ldad/bin/hmingestd.class chmod -R 755 /ldad/classes chmod -R 755 /ldad/data/factor chmod -R 755 /ldad/data/scale chmod -R 755 /ldad/data/ingest chmod -R 755 /data/ldad/$webSite/htdocs chmod -R 755 /data/ldad/www/cgi-bin chmod 777 /data/ldad/$webSite/htdocs/display0.jar chmod 777 /data/ldad/$webSite/htdocs/display1.jar chmod 777 /data/ldad/$webSite/htdocs/ptolemy.plot.jar chmod 755 /ldad/bin/pollForData.pl chmod 755 /ldad/data/pollForData.conf echo "Killing hmingestD processes " cd / kill `ps -ef|grep mx655 |grep -v script |awk '{print $2}'` >/dev/null 2>&1 kill -9 `ps -ef|grep mx655 |grep -v script |awk '{print $2}'` >/dev/null 2>&1 echo "Untarring ldadjavaA class and hmIngest files" cd / tar -xvf ${TARFILE1} cd ${LDAD_HOME} #Copy the hmingestd.class file to the bin directory cp -f /ldad/classes/hmserve/ingest/hmingestd.class /ldad/bin #Creating the localization directory mkdir /ldad/data/localizations #Running the localization #${LDAD_HOME}/bin/localizeLDAD.pl -r MKC -s CO -w DEN -i fsld -n LS #Restart the hmingest daemon echo "starting hmingestd on `date`" cd ${LDAD_HOME}/bin set JAVA_DIR=/opt/java/bin ${JAVA_DIR}/java -mx65536000 -Drun.root.dir=${LDAD_EXTERNAL_HOME} \ -Drun.config.dir=${LDAD_EXTERNAL_HOME}/data \ -Drun.data.dir=/data/ldad/public/javadata \ -Drun.log.dir=${LDAD_EXTERNAL_LOGDIR} \ -Drun.ldaddata.dir=/ldad/data \ hmingestd -d -t ${LDAD_EXTERNAL_HOME} >/dev/null 2>&1 & echo HMingestD #${LDAD_HOME}/bin/startHmIngestd.csh #Remove the tarfile #rm ${TARFILE1} echo "`date` : EXTERNAL LDAD JAVA INSTALL COMPLETE"