de5411a11fb1a61afc9b38af6ebcb9550ac0437c max Tue Feb 16 12:49:01 2016 -0800 move logfile creation via tee a few lines down in gbib's updateBrowser.sh script. This is necessary because tee's exec will create a new subshell, which looks like an already running updateBrowser script and will trigger the main part to stop. refs #16838 diff --git src/browserbox/root/updateBrowser.sh src/browserbox/root/updateBrowser.sh index 5956e4a..8f98202 100755 --- src/browserbox/root/updateBrowser.sh +++ src/browserbox/root/updateBrowser.sh @@ -111,65 +111,67 @@ wget -q --tries=1 --timeout=10 --spider http://hgdownload.soe.ucsc.edu -O /dev/null if [ $? -ne 0 ] ; then echoDebug GBiB has no connection to hgdownload.soe.ucsc.edu, cannot update now exit 3 fi # check flag file if run with no parameter (=from cron) if [ "$#" -eq 0 ] ; then # check a flag file to see if anything on hgdownload actually changed if /root/urlIsNotNewerThanFile $UPDATEFLAG /root/lastUpdateTime.flag then exit 0 fi fi -# keep a log of all output of this script and the date -echo --------------------------------- >> $LOGFILE -date >> $LOGFILE -echo --------------------------------- >> $LOGFILE -exec >> >(tee -a $LOGFILE) 2>&1 - # unless already calling self, update self and call self unless doing only cgis # self-updates are not done when suppressed with notSelf and also not in hgwdev-mode to allow testing of local updateBrowser.sh changes # Internal sidenote: if you want hgwdev CGIs and also the current hgwdev update # script, do a gbibCoreUpdateBeta+updateBrowser hgwdev # gbibCoreUpdateBeta ends with -Beta because it is used during beta time, to # test the current dev update script The update script itself has only a # two-stage release process, beta and final, as the alpha version of the script # is on the GBiB of the developer itself. # the file /root/gbibSkipUpdate allows to skip one single auto-update if [[ ( "$BASH_ARGV" != "notSelf" && "$1" != "hgwdev" ) && ( ! -e /root/gbibSkipNextUpdate ) ]] ; then echo getting new update script # we got three VMs where updateBrowser.sh was 0 bytes, so doing download/move now wget http://hgdownload.soe.ucsc.edu/gbib/updateBrowser.sh -O /root/updateBrowser.sh.new -q && mv /root/updateBrowser.sh.new /root/updateBrowser.sh chmod a+x /root/updateBrowser.sh /root/updateBrowser.sh $1 notSelf exit 0 fi rm -f /root/gbibSkipNextUpdate # check if any hgMirror jobs are running right now # check if the group id file exists and also if any processes exist with this group id # note that the .pid actually contains a group id, not a process id if [ -f /tmp/lastJob.pid ] && [ "$(ps x -o pgid | grep $(cat /tmp/lastJob.pid) | wc -l)" != "0" ] ; then echo a hgMirror job is running right now, not updating exit 4 fi +# --- now do the update --- + +# keep a log of all output of this script and the date +echo --------------------------------- >> $LOGFILE +date >> $LOGFILE +echo --------------------------------- >> $LOGFILE +exec >> >(tee -a $LOGFILE) 2>&1 + # not done, as old customTrash tables will be in innoDb format # and can't be read if we deactivate it now # deactivate inno-db support in mysql. Saves 400-500MB of RAM. #if ! grep skip-innodb /etc/mysql/my.cnf > /dev/null 2> /dev/null ; then #echo - Switching off inno-db in /etc/mysql/my.cnf #sed -i '/^.mysqld.$/a skip-innodb' /etc/mysql/my.cnf #sed -i '/^.mysqld.$/a default-storage-engine=myisam' /etc/mysql/my.cnf #service mysql restart #fi # activate the apt repo 'main' and 'universe' so we can install external software if ! apt-cache policy r-base | grep "Unable to locate" > /dev/null; then if ! grep '^deb http://us.archive.ubuntu.com/ubuntu trusty main universe multiverse$' /etc/apt/sources.list > /dev/null; then echo - Activating the main Ubuntu package repository echo 'deb http://us.archive.ubuntu.com/ubuntu trusty main universe multiverse' >> /etc/apt/sources.list