* Added multi-level incrementals. Still needs testing.
[BackupPC.git] / bin / BackupPC_archive
index 73425d5..e1e9900 100644 (file)
@@ -29,7 +29,7 @@
 #
 #========================================================================
 #
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -157,6 +157,10 @@ local(*RH, *WH);
 # Run an optional pre-archive command
 #
 UserCommandRun("ArchivePreUserCmd");
+if ( $? && $Conf{UserCmdCheckStatus} ) {
+    $stat{hostError} = "ArchivePreUserCmd returned error status $?";
+    exit(ArchiveCleanup($client));
+}
 $NeedPostCmd = 1;
 
 $xfer = BackupPC::Xfer::Archive->new($bpc);
@@ -271,7 +275,13 @@ sub ArchiveCleanup
     #
     # Run an optional post-archive command
     #
-    UserCommandRun("ArchivePostUserCmd") if ( $NeedPostCmd );
+    if ( $NeedPostCmd ) {
+        UserCommandRun("ArchivePostUserCmd");
+        if ( $? && $Conf{UserCmdCheckStatus} ) {
+            $stat{hostError} = "RestorePreUserCmd returned error status $?";
+            $stat{xferOK} = 0;
+        }
+    }
 
     rename("$Dir/ArchiveLOG$fileExt", "$Dir/ArchiveLOG.$lastNum$fileExt");
     rename("$Dir/$reqFileName", "$Dir/ArchiveInfo.$lastNum");