6a56036fe0b6115f872813ff07733f0bda7e785f mspeir Thu Apr 6 16:39:22 2017 -0700 Script was producing truncated files because these lines could fail causing it to quit early. Made it so these lines always come back with zero return code, #18316 diff --git src/utils/qa/getPubHubContact.sh src/utils/qa/getPubHubContact.sh index 3428016..50cb67a 100755 --- src/utils/qa/getPubHubContact.sh +++ src/utils/qa/getPubHubContact.sh @@ -71,48 +71,49 @@ fi # Make header for html file echo -e " <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"> " >> $contactFile while read url label do # Save hub shortLabel as a file so we can use it in a filename later label=$(echo $label | sed -e 's/ /_/g') # Make name for hub.txt output file that includes hub shortLabel hubFile="$base/hubFiles/$label.hub.txt" - wget -t 5 -O $hubFile $url &> /dev/null + wget -t 5 -O $hubFile $url &> /dev/null || true # Extract email from hub.txt file we saved - email=$(egrep "^email" $hubFile) + email=$(egrep "^email" $hubFile) || true # If email is empty, then wget failed or hub is down if [[ $email == "" ]] then + echo "here2" # Attempt to get hub.txt file w/ curl - curl --retry 5 $url -o $hubFile &> /dev/null + curl --retry 5 $url -o $hubFile &> /dev/null || true # Extract email from hub.txt file we saved - email=$(grep "^email" $hubFile) + email=$(grep "^email" $hubFile) || true # If email is still empty, hub is likely down and # we want to use the last email we have as contact email if [[ $email == "" ]] && [ -e $contactFile.old ] then - email=$(grep "$url" $contactFile.old.temp | awk '{print $4" "$5}') + email=$(grep "$url" $contactFile.old.temp | awk '{print $4" "$5}') || true fi fi # Create hyperlinks to hub.txt files hubLink="<a href=\"$url\" target=\"_blank\">$label</a>" # Write contact email + hubUrl to file echo -e "$hubLink $email<br>" >> $contactFile done<<<"$(hgsql -h genome-centdb -Ne "select hubUrl,shortLabel from hubPublic" hgcentral)" # Get line counts for current/old contact info files lineCountNew=$(wc -l $contactFile | cut -d " " -f 1) lineCountOld=$(wc -l $contactFile.old.temp | cut -d " " -f 1) lineDiff=$(expr $lineCountNew - $lineCountOld) # find absolute value of line diff