4274e5376b9d13e83e67cfe1bce8a973643f0afa max Sun Sep 6 07:44:02 2026 -0700 strchiveAutoPush: report and return the real rsync exit code The failure branch read $? after two echo commands had already replaced it, so the log said "code 0" whatever rsync did and the script exited 0 on a failed push. Save the status right after rsync and use it in both messages and the exit. The script is still the uninstalled draft for the sysadmins. refs #38268 diff --git src/hg/utils/otto/strchive/strchiveAutoPush src/hg/utils/otto/strchive/strchiveAutoPush index f96c6d0ab40..29463a324a0 100644 --- src/hg/utils/otto/strchive/strchiveAutoPush +++ src/hg/utils/otto/strchive/strchiveAutoPush @@ -20,34 +20,37 @@ # needs the file it points at, not the link. # # hs1 is served to the browser as a curated hub, but its /gbdb layout is the same # as a native assembly, so it pushes exactly like hg19 and hg38. VICTIM="max@soe.ucsc.edu" TODAY=`date "+%m%d%Y"` OUTFILE="/hive/data/outside/otto/autoPushLogs/strchiveAutoPushLog/strchiveAutoPush.log.$TODAY" PUSHTO="hgwbeta hgw0 hgw1 hgw2 genome-euro genome-asia" for i in $PUSHTO do for db in hg19 hg38 hs1 do echo "Pushing $db STRchive files to $i" >> $OUTFILE - if rsync -avL --rsh=ssh \ + rsync -avL --rsh=ssh \ /gbdb/$db/strVar/strchive.bb \ /gbdb/$db/strVar/strchive.version.txt \ $i:/gbdb/$db/strVar/ >> $OUTFILE + # keep rsync's status, $? is overwritten by the next command + RC=$? + if [ $RC -eq 0 ] then echo " Completed at `date`" >> $OUTFILE echo " " >> $OUTFILE else - echo " ERROR - strchiveAutoPush failed for $db to $i with code $?" - echo " ERROR - strchiveAutoPush failed for $db to $i with code $?" >> $OUTFILE - exit $? + echo " ERROR - strchiveAutoPush failed for $db to $i with code $RC" + echo " ERROR - strchiveAutoPush failed for $db to $i with code $RC" >> $OUTFILE + exit $RC fi done done # If we get here, everything completed without problems. Send mail to the # official victim and we're done. cat $OUTFILE | mailx -s "strchiveAutoPush completed" $VICTIM