X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=bin%2FBackupPC_restore;h=ff9b413a1296f61d44bc3227085cd6da10ad43fc;hp=8f783168a5d6a841d0e242bba0dd2f0e3cc5d543;hb=617af75f7419e95a9c3ea05b05cf21957acc331c;hpb=cfeb65d0e5ef33ef54cf0e5aaa7b3790bf80bff3 diff --git a/bin/BackupPC_restore b/bin/BackupPC_restore index 8f78316..ff9b413 100755 --- a/bin/BackupPC_restore +++ b/bin/BackupPC_restore @@ -208,6 +208,10 @@ local(*RH, *WH); # Run an optional pre-restore command # UserCommandRun("RestorePreUserCmd"); +if ( $? && $Conf{UserCmdCheckStatus} ) { + $stat{hostError} = "RestorePreUserCmd returned error status $?"; + exit(RestoreCleanup($client)); +} $NeedPostCmd = 1; if ( $Conf{XferMethod} eq "tar" ) { @@ -541,7 +545,13 @@ sub RestoreCleanup # # Run an optional post-restore command # - UserCommandRun("RestorePostUserCmd") if ( $NeedPostCmd ); + if ( $NeedPostCmd ) { + UserCommandRun("RestorePostUserCmd"); + if ( $? && $Conf{UserCmdCheckStatus} ) { + $stat{hostError} = "RestorePostUserCmd returned error status $?"; + $stat{xferOK} = 0; + } + } rename("$Dir/RestoreLOG$fileExt", "$Dir/RestoreLOG.$lastNum$fileExt"); rename("$Dir/$reqFileName", "$Dir/RestoreInfo.$lastNum");