clean up old MARC exports after a successful run
authortwirlip <twirlip@twirlip.org>
Thu, 8 Nov 2018 20:45:00 +0000 (12:45 -0800)
committertwirlip <twirlip@twirlip.org>
Thu, 8 Nov 2018 20:45:00 +0000 (12:45 -0800)
.gitignore
marc_export_custom/mucn-full-export-parallel-ebsco-wrapper.sh
marc_export_custom/sitka-full-export-parallel-outlook-wrapper.sh

index d584f4a..6145de5 100644 (file)
@@ -3,3 +3,5 @@ od_config.js
 od_config.*.js
 od_config.coffee
 od_config.*.coffee
 od_config.*.js
 od_config.coffee
 od_config.*.coffee
+marc_export_custom/mucn_ebsco.log
+marc_export_custom/sitka_full_outlook.log
index bcc992e..247c60f 100755 (executable)
@@ -58,3 +58,9 @@ cp $DIR/email-template-${NAME}.sh $OUTDIR/
 chmod +x email-template-${NAME}.sh
 ./email-template-${NAME}.sh "$T" "@$(date +%s)" >email.txt
 /usr/lib/sendmail -t -f sitka-tier2@bc.libraries.coop <email.txt
 chmod +x email-template-${NAME}.sh
 ./email-template-${NAME}.sh "$T" "@$(date +%s)" >email.txt
 /usr/lib/sendmail -t -f sitka-tier2@bc.libraries.coop <email.txt
+
+# log successful export and cleanup old exports, saving this one and the previous one
+echo "$OUTDIR" >> $DIR/mucn_ebsco.log
+head -n -2 $DIR/mucn_ebsco.log | while read OLDEXPORT ; do
+  [ -d "${OLDEXPORT}" ] && rm -rf "${OLDEXPORT}"
+done
index 08c9735..8761ac1 100755 (executable)
@@ -58,3 +58,9 @@ cp $DIR/email-template-${NAME}.sh $OUTDIR/
 chmod +x email-template-${NAME}.sh
 ./email-template-${NAME}.sh "$T" "@$(date +%s)" >email.txt
 /usr/lib/sendmail -t -f sitka-tier2@bc.libraries.coop <email.txt
 chmod +x email-template-${NAME}.sh
 ./email-template-${NAME}.sh "$T" "@$(date +%s)" >email.txt
 /usr/lib/sendmail -t -f sitka-tier2@bc.libraries.coop <email.txt
+
+# log successful export and cleanup old exports, saving this one and the previous one
+echo "$OUTDIR" >> $DIR/sitka_full_outlook.log
+head -n -2 $DIR/sitka_full_outlook.log | while read OLDEXPORT ; do
+  [ -d "${OLDEXPORT}" ] && rm -rf "${OLDEXPORT}"
+done