Skip to main content

Pre Command abort on error of script not working

Thread needs solution

Hallo,

 

I am trying to perform incremental sheduled backups of a target drive, that is not always connected (physically). Since it is located on my Fritz NAS, which is always active, this leads to the behavior, that when the hard drive is not connected, Acronis just starts the action by adding a new folder at the expected location and starting a new full backup - which is not I want. I want the action only to start, if the folder exists.

 

I tried to get the behavior by implementing a pre command, that tests for the directory and fails, when it does not.

I assumed, that this would lead to the expected behavior, when checking "abort action on error".

 

However, it does not. When testing the script all behaves as expected. I get an error when the directory is not there and the script runs through when it does exist. But when I actually run the backup action even though the pre command is executed, the action always starts no matter if the folder exists or not.

What I am doing wrong here?

 

Thanks and kind regards

Finn

0 Users found this helpful

Try using something like the following:

echo off
if not exist D:\Backup\Check.txt goto nodrive
exit /b 0

:nodrive
exit /b 1

The file Check.txt doesn't need to contain anything other than existing in the backup location.

I have tried that with the same result. The backup action is still executed when the file is missing.

What would functionally be the difference between your solution and what I posted?

 

Kind regards

Finn

Finn, there shouldn't have been any real difference between your script and mine - all I know is that my script does work as expected when I use it, so is a puzzle that yours does not?

The other approach that could be used here is to use a similar script approach using the Windows Task Scheduler but let the script launch the Acronis backup task when the correct condition is met!

See KB 47143: Acronis True Image: How to run backups from Command Line for more details.

Using my earlier script, this would be done as follows:

echo off
if not exist D:\Backup\Check.txt goto nodrive

set ATI="C:\Program Files (x86)\Common Files\Acronis\TrueImageHome\TrueImageHomeNotify.exe"
set task="70D75420-9D6D-4727-8412-84C56B257B59"

%ATI% /script:%task%

exit /b 0

:nodrive
exit /b 1

The above is saved in a .BAT file and used in Windows Task Scheduler for a task with Administrator authority, or else can be launched manually etc.