[Swift-commit] r2307 - SwiftApps/adem-osg/bin

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Mon Oct 20 21:15:57 CDT 2008


Author: houzx
Date: 2008-10-20 21:15:56 -0500 (Mon, 20 Oct 2008)
New Revision: 2307

Added:
   SwiftApps/adem-osg/bin/auto-update-sites
Log:
New script import

Added: SwiftApps/adem-osg/bin/auto-update-sites
===================================================================
--- SwiftApps/adem-osg/bin/auto-update-sites	                        (rev 0)
+++ SwiftApps/adem-osg/bin/auto-update-sites	2008-10-21 02:15:56 UTC (rev 2307)
@@ -0,0 +1,80 @@
+# update if have new sites
+#echo "hello"
+DIR="$ADEM_HOME"
+USER=`whoami`
+GRID=$1
+VO=$2
+SFILE=$3
+ 
+for SITE in $(cat $SFILE)
+ do
+  newsite=`/bin/grep $SITE $DIR/bin/.osg-sites.cache`
+  if [ "X$newsite" == "X" ]; then
+  {
+  #get $APP for new sites
+  ID=`/bin/grep $SITE $DIR/tmp/$GRID-sitelist.txt |awk -F, '{print $1}'`
+  /usr/bin/wget -O $DIR/tmp/$ID-site.txt "http://vors.grid.iu.edu/cgi-bin/tindex.cgi?grid=$GRID&VO=$VO&dtype=0&res=$ID" 1>/dev/null 2>/dev/null
+  APP=`/bin/grep app_loc $DIR/tmp/$ID-site.txt |awk -F= '{print $2}'`
+  DATA=`/bin/grep data_loc $DIR/tmp/$ID-site.txt |awk -F= '{print $2}'`
+  LRM=`/bin/grep exec_jm $DIR/tmp/$ID-site.txt |awk -F/  '{print $2}' |cut -d- -f2`
+  NAME=`/bin/grep shortname $DIR/tmp/$ID-site.txt |awk -F= '{print $2}'` 
+
+  #get $Pacman for new sites
+  PacB=`globus-job-run $SITE  /usr/bin/which pacman 2>/dev/null`
+  if [ "X$PacB" != "X" ];then
+  {
+  echo $PacB > $DIR/tmp/Pac-bin-$ID.txt
+  domainP=`/bin/awk -F/ '{print NF}' $DIR/tmp/Pac-bin-$ID.txt`
+  domain=`expr $domainP - 2`
+  Pacman=`/bin/cut -d/ -f1-$domain $DIR/tmp/Pac-bin-$ID.txt`
+  }
+  else
+   {
+   Pacman=$APP/$USER/pacman-3.21
+   ./auto-pacman-inst $SITE $APP &
+    }
+  fi
+
+  #get $Signature for new sites
+  globus-job-run $SITE /bin/mkdir $APP/$USER 2>/dev/null
+  globus-url-copy file://$DIR/auto-getsignature gsiftp://$SITE$APP/$USER/auto-getsignature 2>/dev/null && globus-job-run $SITE  /bin/chmod +x  $APP/$USER/auto-getsignature 
+  Signature=`globus-job-run $SITE  $APP/$USER/auto-getsignature 2>/dev/null` && echo "$SITE $APP $Pacman $Signature $DATA  $LRM  $NAME" >> $DIR/tmp/$GRID-$VO-new-sites.txt
+
+  }
+  fi
+ done
+
+#add the new sites to the .osg-sites.cache
+/bin/cat $DIR/tmp/$GRID-$VO-new-sites.txt  >> $DIR/bin/.osg-sites.cache 2>/dev/null
+
+######update-sites-xml
+  #globus-job-run $SITE /bin/mkdir -p $DATA/$VO/$USER 2>/dev/null &
+NewFile=$DIR/tmp/$GRID-$VO-new-sites.txt
+i=1
+for NSITE in $(awk '{print $1}' $NewFile)
+  do
+{
+  SITE=$NSITE
+  NAME=`sed -n "$i"p $NewFile | awk '{print $7}'`
+  LRM=`sed -n "$i"p $NewFile |awk '{print $6}'`
+  DATA=`sed -n "$i"p $NewFile |awk '{print $5}'` 
+  SitesXML="$DIR/bin/.swift-sites.xml"
+  Line1="<pool handle=\"$NAME\" sysinfo=\"INTEL32::LINUX\">"
+  Line2="<gridftp  url=\"gsiftp://$SITE\" storage=\"$DATA/\$VO/\$USER\" major=\"2\" minor=\"2\" patch=\"4\">"
+  Line3="</gridftp>"
+  Line4="<jobmanager universe=\"vanilla\" url=\"$SITE/jobmanager-$LRM\" major=\"2\" minor=\"2\" patch=\"4\" />"
+  Line5="<workdirectory >$DATA/\$VO/\$USER</workdirectory>"
+  Line6="</pool>"
+  sed -i "s,</config>,$Line1,g" $SitesXML
+  echo $Line2 >> $SitesXML
+  echo $Line3 >> $SitesXML
+  echo $Line4 >> $SitesXML
+  echo $Line5 >> $SitesXML
+  echo $Line6 >> $SitesXML
+  echo ""     >> $SitesXML
+  echo "</config>" >> $SitesXML
+
+  i=`expr $i + 1`
+
+}
+  done


Property changes on: SwiftApps/adem-osg/bin/auto-update-sites
___________________________________________________________________
Name: svn:executable
   + 




More information about the Swift-commit mailing list