My fix for Acronis Pre/Post FAILURE TO "ABORT operation if the user command fails."

Discussion in 'Acronis True Image Product Line' started by alan_b, Jun 25, 2009.

Thread Status:
Not open for further replies.
  1. alan_b

    alan_b Registered Member

    Nov 13, 2008
    Lancashire, England
    If my command fails with an "exit code 7" the Acronis log records the fact,
    and then it disregards my chosen option to ABORT in that situation.

    My command is a batch script with the CMD extension, but the same issue is present for BAT extensions.

    MY FIX :-

    1. I identified the error by appending all DOS commands with
    " 2>> %~dpn0.txt" e.g.
    "MOVE %%Z %1\!VER! " became "MOVE %%Z %1\!VER! 2>> error.txt"
    After a "user command fails" I inspected error.txt and found
    "The process cannot access the file because it is being used by another process."

    I now terminate my script with :-
    TYPE error.txt | FIND /I "Access"
    IF "%ERRORLEVEL%" EQU "0" (
    error.txt does NOT hold "access" if the user command succeeds, so the user command then cleanly terminates as normal.

    If however the user command gets an error, a CMD shell is launched, and Acronis is paused.

    This new shell has the same environmental values from Acronis, but is independant and gives full user interactive control.
    It allows me to see what actions actually failed, and it allows me to repeat relevant commands,
    and if they fail it allows me to test alternative methods to achieve my goals.

    With luck I can manually implement what failed to happen automatically, and when I am "good to go",
    I return to the first CMD shell and hit ENTER and terminate the PAUSE so Acronis backup may resume.

    Although documentation says the "user command" has no i/o interaction capability,
    it does have the ability to PAUSE until allowed to continue.

    I tested the above by changing IF "%ERRORLEVEL%" EQU "0" to IF "%ERRORLEVEL%" NEQ "0",
    and I kept Acronis waiting for 15 minutes before I cancelled the PAUSE,
    and Acronis then completed the backup perfectly.

    In my case the original fault was
    "The process cannot access the file because it is being used by another process."
    Normally my user command is launched 1 second BEFORE "LOCKING partition C:..."
    I suspect the fault is a race hazard where partition C: is locked BEFORE the user command.

    Because I am now able to deal with these errors, they no longer occur ! !
Thread Status:
Not open for further replies.