From bd0ec7ba78994fde10ce3388e691fb2d3e53590f Mon Sep 17 00:00:00 2001 From: mattf Date: Mon, 11 Nov 2019 22:45:57 +0000 Subject: [PATCH] 'now' option for export range with 5am caveat to the expired list exporter perl script git-svn-id: svn://192.168.202.10@3163 3d104415-ff17-0410-8863-d5cf3c621b8a --- .../trunk/bin/AST_expired_list_exporter.pl | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/agc_2-X/trunk/bin/AST_expired_list_exporter.pl b/agc_2-X/trunk/bin/AST_expired_list_exporter.pl index c716ef3a..555ab7d8 100644 --- a/agc_2-X/trunk/bin/AST_expired_list_exporter.pl +++ b/agc_2-X/trunk/bin/AST_expired_list_exporter.pl @@ -26,10 +26,11 @@ # --destination_folder (optional, used for specifying a destination folder to # transfer to once logged into the FTP account) # -# Copyright (C) 2018 Matt Florell , Joe Johnson LICENSE: AGPLv2 +# Copyright (C) 2019 Matt Florell , Joe Johnson LICENSE: AGPLv2 # # 180307-2120 - First Build # 180625-0211 - Added options to use different date ranges for exports and deletes +# 191111-1700 - Committed 'now' option for export range with 5am caveat # ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); @@ -214,7 +215,7 @@ if ($rslt->rows>0) my @data_in = split(/--last_call_date_days=/,$args); $last_call_date_days = $data_in[1]; $last_call_date_days =~ s/ .*//gi; - $last_call_date_days =~ s/[^0-9]//gi; + $last_call_date_days =~ s/[^0-9|(now)]//gi; if ($DB) {print "\n----- LAST CALL DATE EXPIRATION DAYS: $last_call_date_days -----\n\n";} } if ($args =~ /--last_call_date_days_export/i) @@ -222,7 +223,7 @@ if ($rslt->rows>0) my @data_in = split(/--last_call_date_days_export=/,$args); $last_call_date_days_export = $data_in[1]; $last_call_date_days_export =~ s/ .*//gi; - $last_call_date_days_export =~ s/[^0-9]//gi; + $last_call_date_days_export =~ s/[^0-9|(now)]//gi; if ($DB) {print "\n----- LAST CALL DATE EXPIRATION DAYS, EXPORT ONLY: $last_call_date_days_export -----\n\n";} } if ($args =~ /--last_call_date_days_delete/i) @@ -230,7 +231,7 @@ if ($rslt->rows>0) my @data_in = split(/--last_call_date_days_delete=/,$args); $last_call_date_days_delete = $data_in[1]; $last_call_date_days_delete =~ s/ .*//gi; - $last_call_date_days_delete =~ s/[^0-9]//gi; + $last_call_date_days_delete =~ s/[^0-9|(now)]//gi; if ($DB) {print "\n----- LAST CALL DATE EXPIRATION DAYS, DELETE ONLY: $last_call_date_days_delete -----\n\n";} } if ($args =~ /--custom_ftp_host/i) @@ -310,6 +311,24 @@ if ($rslt->rows>0) print "Script failed - missing FTP info\n"; exit; } + if ($last_call_date_days_export=~/now/i) + { + $last_call_date_days_export=0; + if ($hour>5) + { + print "Script failed - cannot run 'now' date range after 6am.\n"; + exit; + } + } + if ($last_call_date_days_delete=~/now/i) + { + $last_call_date_days_delete=0; + if ($hour>5) + { + print "Script failed - cannot run 'now' date range after 6am.\n"; + exit; + } + } if (!$custom_ftp_port) {$custom_ftp_port=21;} #### EXPORT SEGMENT