Added --localdatedir option to step 3 FTP scripts

git-svn-id: svn://192.168.202.10@3001 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2018-06-17 02:57:36 +00:00
parent cafdf4bda9
commit d41acf4fa2
4 changed files with 116 additions and 6 deletions
+54 -2
View File
@@ -58,6 +58,7 @@
# 150911-2336 - Added GPG encrypted audio file compatibility
# 160406-2055 - Added YMDdatedir option
# 180511-2018 - Added --YearYMDdatedir option
# 180616-2248 - Added --localdatedir option
#
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
@@ -114,6 +115,7 @@ if (length($ARGV[0])>1)
print " [--nodatedir] = do not put into dated directories\n";
print " [--YMDdatedir] = put into Year/Month/Day dated directories\n";
print " [--YearYMDdatedir] = put into Year/YYYYMMDD dated directories\n";
print " [--localdatedir] = create dated directories inside of FTP directory on local server\n";
print " [--run-check] = concurrency check, die if another instance is running\n";
print " [--max-files=x] = maximum number of files to process, defaults to 100000\n";
print " [--ftp-server=XXX] = FTP server\n";
@@ -158,6 +160,11 @@ if (length($ARGV[0])>1)
$YearYMDdatedir=1;
if ($DB) {print "\n----- Year/YYYYMMDD DATED DIRECTORIES -----\n\n";}
}
if ($args =~ /--localdatedir/i)
{
$localdatedir=1;
if ($DB) {print "\n----- CREATE LOCAL DATED DIRECTORIES: $localdatedir -----\n\n";}
}
if ($args =~ /--run-check/i)
{
$run_check=1;
@@ -530,7 +537,7 @@ foreach(@FILES)
}
}
}
$ftp->binary();
$ftp->binary() or die "Cannot set binary transfer, is server connected?";
$ftp->put("$dir2/$ALLfile", "$ALLfile");
if ($FTPvalidate > 0)
{
@@ -554,7 +561,52 @@ foreach(@FILES)
if (!$T)
{
`mv -f "$dir2/$ALLfile" "$PATHDONEmonitor/FTP/$ALLfile"`;
$localDIR='';
if ( ($localdatedir > 0) && ($NODATEDIR < 1) )
{
if ($YMDdatedir > 0)
{
if (-d "$PATHDONEmonitor/FTP/$year")
{if($DBX) {print "Year directory exists: $PATHDONEmonitor/FTP/$year\n";}}
else
{mkdir("$PATHDONEmonitor/FTP/$year",0755); if($DBX) {print "Year directory created: $PATHDONEmonitor/FTP/$year\n";}}
if (-d "$PATHDONEmonitor/FTP/$year/$mon")
{if($DBX) {print "Month directory exists: $PATHDONEmonitor/FTP/$year/$mon\n";}}
else
{mkdir("$PATHDONEmonitor/FTP/$year/$mon",0755); if($DBX) {print "Month directory created: $PATHDONEmonitor/FTP/$year/$mon\n";}}
if (-d "$PATHDONEmonitor/FTP/$year/$mon/$mday")
{if($DBX) {print "Day directory exists: $PATHDONEmonitor/FTP/$year/$mon/$mday\n";}}
else
{mkdir("$PATHDONEmonitor/FTP/$year/$mon/$mday",0755); if($DBX) {print "Day directory created: $PATHDONEmonitor/FTP/$year/$mon/$mday\n";}}
$localDIR = "$year/$mon/$mday/";
}
else
{
if ($YearYMDdatedir > 0)
{
if (-d "$PATHDONEmonitor/FTP/$year")
{if($DBX) {print "Year directory exists: $PATHDONEmonitor/FTP/$year\n";}}
else
{mkdir("$PATHDONEmonitor/FTP/$year",0755); if($DBX) {print "Year directory created: $PATHDONEmonitor/FTP/$year\n";}}
if (-d "$PATHDONEmonitor/FTP/$year/$start_date")
{if($DBX) {print "Full-date directory exists: $PATHDONEmonitor/FTP/$year/$start_date\n";}}
else
{mkdir("$PATHDONEmonitor/FTP/$year/$start_date",0755); if($DBX) {print "Year directory created: $PATHDONEmonitor/FTP/$year/$start_date\n";}}
$localDIR = "$year/$start_date/";
}
else
{
if (-d "$PATHDONEmonitor/FTP/$start_date")
{if($DBX) {print "Full-date directory exists: $PATHDONEmonitor/FTP/$start_date\n";}}
else
{mkdir("$PATHDONEmonitor/FTP/$start_date",0755); if($DBX) {print "Year directory created: $PATHDONEmonitor/FTP/$start_date\n";}}
$ftp->mkdir("$start_date");
$ftp->cwd("$start_date");
$localDIR = "$start_date/";
}
}
}
`mv -f "$dir2/$ALLfile" "$PATHDONEmonitor/FTP/$localDIR$ALLfile"`;
}
if($DBX){print STDERR "Transfered $transfered_files files\n";}
+54 -2
View File
@@ -56,6 +56,7 @@
#
#
# 180518-0732 - First Build based upon AST_CRON_audio_3_ftp.pl script
# 180616-2248 - Added --localdatedir option
#
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
@@ -112,6 +113,7 @@ if (length($ARGV[0])>1)
print " [--nodatedir] = do not put into dated directories\n";
print " [--YMDdatedir] = put into Year/Month/Day dated directories\n";
print " [--YearYMDdatedir] = put into Year/YYYYMMDD dated directories\n";
print " [--localdatedir] = create dated directories inside of FTP directory on local server\n";
print " [--noping] = do not attempt to ping FTP server\n";
print " [--run-check] = concurrency check, die if another instance is running\n";
print " [--max-files=x] = maximum number of files to process, defaults to 100000\n";
@@ -163,6 +165,11 @@ if (length($ARGV[0])>1)
$YearYMDdatedir=1;
if ($DB) {print "\n----- Year/YYYYMMDD DATED DIRECTORIES -----\n\n";}
}
if ($args =~ /--localdatedir/i)
{
$localdatedir=1;
if ($DB) {print "\n----- CREATE LOCAL DATED DIRECTORIES: $localdatedir -----\n\n";}
}
if ($args =~ /--run-check/i)
{
$run_check=1;
@@ -557,7 +564,7 @@ foreach(@FILES)
}
}
}
$ftps->binary();
$ftps->binary() or die "Cannot set binary transfer, is server connected?";
$ftps->put("$dir2/$ALLfile", "$ALLfile");
# if ($FTPvalidate > 0)
# {
@@ -580,7 +587,52 @@ foreach(@FILES)
if (!$T)
{
`mv -f "$dir2/$ALLfile" "$PATHDONEmonitor/FTP/$ALLfile"`;
$localDIR='';
if ( ($localdatedir > 0) && ($NODATEDIR < 1) )
{
if ($YMDdatedir > 0)
{
if (-d "$PATHDONEmonitor/FTP/$year")
{if($DBX) {print "Year directory exists: $PATHDONEmonitor/FTP/$year\n";}}
else
{mkdir("$PATHDONEmonitor/FTP/$year",0755); if($DBX) {print "Year directory created: $PATHDONEmonitor/FTP/$year\n";}}
if (-d "$PATHDONEmonitor/FTP/$year/$mon")
{if($DBX) {print "Month directory exists: $PATHDONEmonitor/FTP/$year/$mon\n";}}
else
{mkdir("$PATHDONEmonitor/FTP/$year/$mon",0755); if($DBX) {print "Month directory created: $PATHDONEmonitor/FTP/$year/$mon\n";}}
if (-d "$PATHDONEmonitor/FTP/$year/$mon/$mday")
{if($DBX) {print "Day directory exists: $PATHDONEmonitor/FTP/$year/$mon/$mday\n";}}
else
{mkdir("$PATHDONEmonitor/FTP/$year/$mon/$mday",0755); if($DBX) {print "Day directory created: $PATHDONEmonitor/FTP/$year/$mon/$mday\n";}}
$localDIR = "$year/$mon/$mday/";
}
else
{
if ($YearYMDdatedir > 0)
{
if (-d "$PATHDONEmonitor/FTP/$year")
{if($DBX) {print "Year directory exists: $PATHDONEmonitor/FTP/$year\n";}}
else
{mkdir("$PATHDONEmonitor/FTP/$year",0755); if($DBX) {print "Year directory created: $PATHDONEmonitor/FTP/$year\n";}}
if (-d "$PATHDONEmonitor/FTP/$year/$start_date")
{if($DBX) {print "Full-date directory exists: $PATHDONEmonitor/FTP/$year/$start_date\n";}}
else
{mkdir("$PATHDONEmonitor/FTP/$year/$start_date",0755); if($DBX) {print "Year directory created: $PATHDONEmonitor/FTP/$year/$start_date\n";}}
$localDIR = "$year/$start_date/";
}
else
{
if (-d "$PATHDONEmonitor/FTP/$start_date")
{if($DBX) {print "Full-date directory exists: $PATHDONEmonitor/FTP/$start_date\n";}}
else
{mkdir("$PATHDONEmonitor/FTP/$start_date",0755); if($DBX) {print "Year directory created: $PATHDONEmonitor/FTP/$start_date\n";}}
$ftp->mkdir("$start_date");
$ftp->cwd("$start_date");
$localDIR = "$start_date/";
}
}
}
`mv -f "$dir2/$ALLfile" "$PATHDONEmonitor/FTP/$localDIR$ALLfile"`;
}
if($DBX){print STDERR "Transfered $transfered_files files\n";}
+1 -1
View File
@@ -394,7 +394,7 @@ foreach(@FILES)
$ftp->cwd("$start_date");
$start_date_PATH = "$start_date/";
}
$ftp->binary();
$ftp->binary() or die "Cannot set binary transfer, is server connected?";
$ftp->put("$dir2/$ALLfile", "$ALLfile");
if ($FTPvalidate > 0)
{
+7 -1
View File
@@ -105,7 +105,8 @@ that are not sent to agents such as DROPs, No Answers, Busys and timeouts. This
option is available for Campaigns and In-Groups. This feature will only work for
auto-dial and inbound calls, not manual dial calls. For inbound calls, the
specific in-group that a call was sent to needs to have the No Agent Call URL
field filled in or this function will not run for that call.
field filled in or this function will not run for that call. To send the
status of the call, just use the --A--status--B-- variable.
################################################################################
@@ -152,6 +153,11 @@ did_custom_five
For most of the functions above, you can also reference custom list fields using
the standard --A-- and --B-- around the custom field ID
NOTE: Most of these URL features have variables available for use that are not
documented on this page. If you want to confirm what variables are available
outside of the ones mentioned here, you should look in the code.
################################################################################
# EXAMPLES