Skip to main content

Script to quit a backup without generating an error.

Thread needs solution

Hi,

 

On the latest versions of Acronis True Image or on Acronis Cyber Protection, the "do not execute if drive is not attached" function does not exist.

How to skip the backup for which the storage medium is not attached without throwing an error, so that I only receive a notification if it fails for a real cause?

A few years ago, Steve had proposed a small script to run in pre-command (for another problem) :

 

echo-off

if not exist Y:\ goto nodrive

exit /b 0

:nodrive exit /b 1

 

but it generates an error which triggers a notification.

Is it possible to modify this script so that it exits the backup without error ?

 

 

Thanks.

 

Stéphane.

0 Users found this helpful

Stéphane, the intent of using a Pre Command is to prevent a backup task from continuing when a specified condition is not satisfied, i.e. the destination drive is not available / connected, but to do this you have to select the two options when the Pre Command is setup:

Do not perform operations until the command's execution is complete

Abort the operation if the user command fails

The first option ensures that Acronis does not start the backup before the Pre Command has finished whatever actions have been configured, i.e. test for the backup drive being present.

The second option is required in order to test the outcome of the Pre Command, i.e. did it succeed (exit code = 0) or did it fail (exit code = 1). 

Unfortunately, aborting the operation will still signal a notification to advise this status and there is no direct method of preventing this when using the integrated Acronis Scheduler to launch the task other than as below.

Note: the Pre Command should be used in conjunction with the Options > Advanced > Error handling options, in particular:

Do not show messages and dialogs while processing (silent mode)

You may also want to choose whether you want to 'Repeat attempt if a backup fails'? 
This will cause the Pre Command to also be repeated for the number of attempts configured.

The alternative would be to set up a batch file that includes the option to launch the Acronis backup task after performing the successful test for the external backup drive, and run this from the Windows Task Scheduler instead of using the Acronis Scheduler.

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

Example: CheckDriveRunTask.BAT (to launch via Windows Task Scheduler)

@echo off
set ATI="C:\Program Files (x86)\Common Files\Acronis\TrueImageHome\TrueImageHomeNotify.exe"
set task1=30089F46-F0D4-4696-903E-41162235E361
set usbhdd="S:"

if not exist %usbhdd% goto nodrive
echo Launching ATI Task
%ATI% /script:%task1%
exit /b 0

:nodrive
echo "Drive not found!"
exit /b 1

The path for the TrueImageHomeNotify.exe would need to be changed for ACPHO and the task1 value needs to match your own backup task script identifier as well as the usbhdd drive letter to match the drive on your system.

Hi Steve.

 

Thanks for your help.

Unfortunately, running backups via scheduled tasks is not an option, it would be too much work.

Could you still help me?
Would it be possible to "kill" the backup task in case the storage medium is not connected, via a script like this:

echo-off

if not exist Y:\ goto nodrive
exit /b 0

:nodrive
pskill 8F01AC13-F59E-4851-9204-DE1FD77E36B4
exit /b 0

I tested this type of script without success, but maybe it is not well written or the backup ID is not the right one.

Hence this other question, how to determine task ID with Acronis Cyber Protect Cloud? I couldn't find the equivalent of the "Scripts" folder on my PC.

 

Thanks.

Have a good day.

Stephane

I think that trying to kill the Acronis task from a Pre Command within the same task would cause more issues that it solves and could even cause a system crash potentially.

Windows has no knowledge of the Acronis task script identifiers you used in the pskill command as it is being run via an Acronis executable (which varies according to the type of backup being made).

For finding the script ID's - I would recommend using the MVP Assistant tool which will display this information for you on the Acronis Configuration panel of the tool when you select a task.
Shown as the Backup Task UUID: in the right side panel.

MVP Assistant - New 2.0 with Rescue Media Builder (New Version 2.4.2)

Hi Steve.

Thanks again for your answer.

I think I've to wait for an evolution of Acronis, so that the function is (re)introduced ...

 

Best regards.

Stéphane.