I would like to perform an action when the backup completes successfully (but not when it fails).
- Is there a way to pass the backup status into a post-backup command?
- Or an environment variable I can query from the post-backup?
- Or an easy way to query the status of the job (multiple jobs could be running).
- Considering login to the event log and using LogParser to search for the success message.
I am currently using the email notification, sending the email to a bot, which parses out the backup status from the subject, then runs a command if the backup was successful.
Product: Acronis Backup & Recovery 10
From what I've seen, there isn't an easy way.
Like you, I currently get a post-task status email; however, I'd like to get a subset of that information into a dashboard system. I just wrote a python (3.4) script to extract info from the Acronis logs and write to a log file. I've added in the ability to conditionally execute commands too. (I did this part in a batch file, but the python script could be modified to execute commands...thereby removing the need for the batch file.)
With some slight modification/customization, this should work for you.
Concept
Caveats
Requirements
untangle
python package is installed (pip install untangle
)Steps
Create the following batch file and save it as
acronis-last-log.cmd
. Change the applicable commands to conditionally perform actions.Create the following python script and save it as
acronis-last-log.py
and put it in the same folder as the batch file. Make sure to visit theCONFIGURATION VARIABLES
section to change any paths or options. Note: This does create a taskname-based log file which overwrites itself each time the Acronis task is executed. To disable the log file, comment out thewith open(...) as outFile
andprint(..., file=outFile)
lines, making sure to adjust any code indentations as needed. To change the log path, edit theoutputPath
variable.Configure Acronis to run a batch file (
acronis.cmd
) as a post-command action with the below dialog settings:C:/path/to/acronis.cmd
C:/path/to
(location of the batch file)Edit: leaving the 'Do not perform operations...' checkbox checked might yield XML parsing errors, as the log file might not have flushed yet.
See Cyber's comprehensive answer - this the route I would recommend.
Before Cyber's post, I did have some success with LogParser, as I wanted to track 2 backup jobs.
Caveat This LogParser solution is susceptible to false positives (e.g. if one job ran twice, and the other didn't run, then you would get the same results as both jobs succeeding).
Acronis 10 does not seem to post enough detail to the windows logs to be able to uniquely identify jobs succeeding or even starting.
check-acronis-backup.bat
check-acronis-backup.sql