+
+#
+# Run an optional pre- or post-dump command
+#
+sub UserCommandRun
+{
+ my($type) = @_;
+
+ return if ( !defined($Conf{$type}) );
+ my $vars = {
+ xfer => $xfer,
+ client => $client,
+ host => $host,
+ hostIP => $hostIP,
+ share => $ShareNames->[0],
+ shares => $ShareNames,
+ XferMethod => $Conf{XferMethod},
+ LOG => *LOG,
+ XferLOG => $XferLOG,
+ stat => \%stat,
+ xferOK => $stat{xferOK},
+ type => $type,
+ };
+ my $cmd = $bpc->cmdVarSubstitute($Conf{$type}, $vars);
+ $XferLOG->write(\"Executing $type: @$cmd\n");
+ #
+ # Run the user's command, dumping the stdout/stderr into the
+ # Xfer log file. Also supply the optional $vars and %Conf in
+ # case the command is really perl code instead of a shell
+ # command.
+ #
+ $bpc->cmdSystemOrEval($cmd,
+ sub {
+ $XferLOG->write(\$_[0]);
+ },
+ $vars, \%Conf);
+}