328 |
|
|
329 |
Trace SQL statements. |
Trace SQL statements. |
330 |
|
|
331 |
|
=item phone |
332 |
|
|
333 |
|
Phone number to message when the load finishes. |
334 |
|
|
335 |
=back |
=back |
336 |
|
|
337 |
=cut |
=cut |
358 |
loadOnly => [0, "load the database from previously generated files"], |
loadOnly => [0, "load the database from previously generated files"], |
359 |
primaryOnly => [0, "only process the group's main entity"], |
primaryOnly => [0, "only process the group's main entity"], |
360 |
resume => [0, "resume a complete load starting with the first group specified in the parameter list"], |
resume => [0, "resume a complete load starting with the first group specified in the parameter list"], |
361 |
|
phone => ["", "phone number (international format) to call when load finishes"], |
362 |
}, |
}, |
363 |
"<group1> <group2> ...", |
"<group1> <group2> ...", |
364 |
@ARGV); |
@ARGV); |
385 |
} elsif (! @parameters) { |
} elsif (! @parameters) { |
386 |
Confess("No load groups were specified."); |
Confess("No load groups were specified."); |
387 |
} |
} |
388 |
|
# Set a variable to contain return type information. |
389 |
|
my $rtype; |
390 |
|
# Insure we catch errors. |
391 |
|
eval { |
392 |
# Process the parameters. |
# Process the parameters. |
393 |
for my $group (@parameters) { |
for my $group (@parameters) { |
394 |
Trace("Processing load group $group.") if T(2); |
Trace("Processing load group $group.") if T(2); |
442 |
$group = ResumeCheck($resume, $group); |
$group = ResumeCheck($resume, $group); |
443 |
} |
} |
444 |
} |
} |
445 |
|
}; |
446 |
|
if ($@) { |
447 |
|
Trace("Load failed with error: $@") if T(0); |
448 |
|
$rtype = "error"; |
449 |
|
} else { |
450 |
Trace("Load complete.") if T(2); |
Trace("Load complete.") if T(2); |
451 |
|
$rtype = "no error"; |
452 |
|
} |
453 |
|
if ($phone) { |
454 |
|
my $msgID = Tracer::SendSMS($options->{phone}, "Sprout load terminated with $rtype."); |
455 |
|
if ($msgID) { |
456 |
|
Trace("Phone message sent with ID $msgID.") if T(2); |
457 |
|
} else { |
458 |
|
Trace("Phone message not sent.") if T(2); |
459 |
|
} |
460 |
|
} |
461 |
# If the resume flag is set, return "*", else return "". |
# If the resume flag is set, return "*", else return "". |
462 |
sub ResumeCheck { |
sub ResumeCheck { |
463 |
my ($resume, $group) = @_; |
my ($resume, $group) = @_; |