bin/run-mirrors: Run post scripts after mirror jobs. master
authorMark Wooding <mdw@distorted.org.uk>
Thu, 28 Aug 2014 14:54:16 +0000 (15:54 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Thu, 28 Aug 2014 14:54:16 +0000 (15:54 +0100)
After a mirror JOB, run the scripts in etc/post-JOB.d/ to do any other
necessary things.  This is useful for jobs like `mirror' which do lots
of unrelated things.

bin/run-mirrors

index 34a3733..cddea70 100755 (executable)
@@ -56,5 +56,15 @@ for file in $(run-parts --list etc/mirrors.d); do
     set +e; (trap - INT; exec "$file"); rc=$?; set -e
     echo
     echo "*** Finished $(date +%Y-%m-%dT%H:%M:%S); rc = $rc"
+    if [ -d etc/post-$base.d ]; then
+      for i in $(run-parts --list etc/post-$base.d); do
+       s=${i##*/}
+       echo
+       echo "*** Running post-script $s at $(date +%Y-%m-%dT%H:%M:%S)"
+       set +e; (trap - INT; exec "$i"); rc=$?; set -e
+       echo
+       echo "*** Finished post-script $s $(date +%Y-%m-%dT%H:%M:%S); rc = $rc"
+      done
+    fi
   ) >>log/$base.log 2>&1
 done