'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
This commit is contained in:
mattf
2019-11-11 22:45:57 +00:00
parent cae5abfd3a
commit c54d454c5b
+23 -4
View File
@@ -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 <vicidial@gmail.com>, Joe Johnson <freewermadmin@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2019 Matt Florell <vicidial@gmail.com>, Joe Johnson <freewermadmin@gmail.com> 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