668eca662193cfbd09e7d8d43b51db3d1919a478
max
  Tue Dec 9 02:34:26 2014 -0800
changes after code review refs #14501
diff --git src/browserbox/root/updateBrowser.sh src/browserbox/root/updateBrowser.sh
index 748dc48..d646eb9 100755
--- src/browserbox/root/updateBrowser.sh
+++ src/browserbox/root/updateBrowser.sh
@@ -3,35 +3,46 @@
 # update script on the box
 # - updates itself and then run itself
 # - updates cgis, html and gbdb via rsync 
 # - updates hg.conf via wget
 # - patches the menu
 # - hides conservation+retro 
 # - removes some searches if latency to UCSC is > 90msecs
 
 # will not run if:
 # - not run as root
 # - if a script named updateBrowser.sh already is running
 # - any hgMirror jobs are running
 # - hgdownload is offline
 # - if a flagFile on hgDownload is not more recent than a local flag file
 
+# an interrupted update script will not touch the local flagfile, so they will
+# be restarted after the next reboot or when the cronjob is run, whichever
+# comes first
+
+# To find out why the script did not run, use the command echo $? to show the
+# exit code of the script
+
 # parameters:
 # - parameter "hgwdev": does not update itself, copies only the beta/alpha CGIs/htdocs from hgwdev
 # - parameter "notSelf": does not update itself and does not check flagfile
 
-# rsync options:
+# this script is not using the bash options pipefail or errabort.
+# In case something goes wrong it continues, this is intentional to 
+# avoid a machine that does not update itself anymore
+
+# rsync options help:
 # l = preserve symlinks
 # t = preserve time
 # r = recurse
 # z = compress
 # v = verbose
 # h = human readable
 # u = skip if file is newer on receiver
 RSYNCOPTS="-ltrzvh --partial"
 # rsync server for CGIs and html files
 RSYNCSRC="rsync://hgdownload.cse.ucsc.edu"
 RSYNCCGIBIN=cgi-bin
 RSYNCHTDOCS=htdocs
 UPDATEFLAG=http://hgdownload.cse.ucsc.edu/gbib/lastUpdate
 
 # help
@@ -136,38 +147,44 @@
   
     # remove things that are on hgwdev beta directories but not necessary on the gbib
     if [ "$dirExt" == "beta" ] ; then
       RSYNCAPACHE="$RSYNCAPACHE --exclude favicon*.ico --exclude hg.conf* --exclude ENCODE --exclude *.gz --exclude *.bw --exclude *.bb --exclude *.bam --exclude goldenPath/**.pdf --exclude admin --exclude goldenPath/customTracks --exclude pubs --exclude ancestors --exclude training --exclude trash --exclude .htaccess --exclude htdocs --exclude Neandertal --exclude RNA-img --exclude ebola --exclude encodeDCC --exclude evoFold --exclude geneExtra --exclude js-public --exclude style-public --exclude hgNearData --exclude visiGeneData --exclude visiGene"
     fi
 
     rsync $RSYNCAPACHE $user@hgwdev.soe.ucsc.edu:/usr/local/apache/htdocs${htmlExt}/ /usr/local/apache/htdocs/
     rsync $RSYNCAPACHE $user@hgwdev.soe.ucsc.edu:/usr/local/apache/cgi-bin${cgiExt}/ /usr/local/apache/cgi-bin/
 
     PUSHLOC=$user@hgwdev.soe.ucsc.edu:/usr/local/apache/htdocs/gbib/push/
 
 # normal public updates from hgdownload are easier, not many excludes necessary
 else
     # update CGIs
     echo updating CGIs...
-    rsync --delete -u $RSYNCOPTS $RSYNCSRC/$RSYNCCGIBIN /usr/local/apache/cgi-bin/ --exclude=hg.conf --exclude edw* --exclude *private --exclude hgNearData --exclude visiGeneData --exclude Neandertal 
+    rsync --delete -u $RSYNCOPTS $RSYNCSRC/$RSYNCCGIBIN /usr/local/apache/cgi-bin/ --exclude=hg.conf --exclude=hg.conf.local --exclude edw* --exclude *private --exclude hgNearData --exclude visiGeneData --exclude Neandertal 
 
     echo updating HTML files...
     rsync --delete -u $RSYNCOPTS $RSYNCSRC/$RSYNCHTDOCS/ /usr/local/apache/htdocs/ --include **/customTracks/*.html --exclude ENCODE/ --exclude *.bam --exclude *.bb --exclude */*.bw --exclude */*.gz --exclude favicon.ico --exclude folders --exclude ancestors --exclude admin --exclude goldenPath/customTracks --exclude images/mammalPsg --exclude style/gbib.css --exclude images/title.jpg --exclude images/homeIconSprite.png --exclude goldenPath/**.pdf --exclude training
 
     PUSHLOC=hgdownload.cse.ucsc.edu::gbib/push/
 fi
 
+# hg.conf.local is not updated from hgdownload, but re-created if it does not exist
+if [ ! -f /usr/local/apache/cgi-bin/hg.conf.local ]; then
+    echo "Creating hg.conf.local"
+    echo allowHgMirror=false > /usr/local/apache/cgi-bin/hg.conf.local
+fi
+
 chown -R www-data.www-data /usr/local/apache/cgi-bin/*
 chown -R www-data.www-data /usr/local/apache/htdocs/
 chmod -R a+r /usr/local/apache/htdocs
 
 if [ "$1" != "hgwdev" ] ; then
   echo updating GBDB files...
   rsync $RSYNCOPTS --existing rsync://hgdownload.cse.ucsc.edu/gbdb/ /data/gbdb/
   chown -R www-data.www-data /data/gbdb/
 fi
 
 echo pulling other files
 rsync $RSYNCOPTS $PUSHLOC /
 
 if [ "$1" != "hgwdev" ] ; then
   echo updating MYSQL files - browser will not work during the MYSQL update