Invoice export deletes previous day's local file
authorBill Erickson <berickxx@gmail.com>
Wed, 8 May 2019 20:31:32 +0000 (20:31 +0000)
committerBill Erickson <berickxx@gmail.com>
Fri, 10 May 2019 19:44:43 +0000 (19:44 +0000)
Keep only the most recent invoice export CVS file on the source
(utility) server in case of delivery failure to prod-depot.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
KCLS/utility-scripts/export_invoices/export_invoices.sh

index 7ae0343..d3aa660 100755 (executable)
@@ -17,5 +17,10 @@ echo "CSV export file created: $CSV_FILE"
 
 scp "$CSV_FILE" prod-depot.eg.kcls.org:/home/sftpinv/pending/
 
+# Remove yesterday's CSV export file
+rm -f /tmp/invoice-export.*.csv.delete_me
+# Tag today's file as deletable
+mv "$CSV_FILE" "$CSV_FILE.delete_me"
+
 echo -n "Invoice exports complete "
 date +"%F %T"