Skip to main content

AMS Backup-Optionen Vor-/Nach-Befehle batch aufrufen nicht möglich

Thread needs solution
Forum Member
Posts: 14
Comments: 22

Hallo zusammen,

ich möchte gerne in einem Backup-Job die Option "Vor-/Nach-Befehle" nutzen.
Egal was ich auch versuche eine Batch-Datei aufzurufen, der Job wird immer fehlerhaft abgebrochen.

Folgende Batchdateien möchte ich gerne aufrufen (siehe Anhang). Die ein vor, die andere nach dem Job.
Wie genau müssen diese im Job auf dem AMS eingetragen werden (siehe Anhang)?
Das kann doch nicht so schwer sein. Aber es funktioniert einfach nicht!

Danke.

 

Attachment Size
1-2016-02-10_21_38_08.jpg 29.66 KB
2-2016-02-10.jpg 23.34 KB
0 Users found this helpful
Forum Member
Posts: 5
Comments: 26

kurze zwischenfrage. erfolgt das backup über die appliance oder über agenten?

Acronis Program Manager
Posts: 22
Comments: 3098

Hi Sanches,

The pre/post commands you specify will be executed on the backup agent side, so if you're creating a backup job from Acronis Management Server machine, you should ensure that the batch files are actually located on the backup agent side (i.e. on the machine which will actually perform the backup). If this doesn't help please clarify the exact symptoms and attach the backup log file from the backup task where you've set up the pre/post commands, so that I can check and advise further.

Thank you.

--

Best regards,

Vasily

Acronis Virtualization Program Manager

Forum Member
Posts: 14
Comments: 22

The machine which will actually perform the backup vm is a virtual appliance and the corresponding agent.
But how should I store the batch files on appliance? This is a closed system! And I have no access to the file system.

Thank you.

Forum Member
Posts: 5
Comments: 26

the batch has to be placed on the vm you want to backup.

if you use the esx appliance you actually dont need the batch to shutdown services on the backed up vm. a snapshot will be created and then the snapshot will be backed up.

Acronis Program Manager
Posts: 22
Comments: 3098

Hi,

The functionality of pre/post commands execution is not applicable to running batch files inside the VMs. It's only applicable to running tasks on backup agent side as mentioned in my previous comment. 

If you want to run scripts inside the VM, you should use the native VMware Tools functionality which trigger the commands before/after the VMware snapshot is taken on the VM. When the backup starts - it triggers VMware snapshot and therefore your commands will be executed. See http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1006671 for instructions.

Thank you.

--

Best regards,

Vasily

Acronis Virtualization Program Manager

Forum Member
Posts: 14
Comments: 22

Hallo, das kann nicht sein.
Wenn ich folgenden batch als Vor-Befehl zum testen angebe und dann den Backup-Job laufen lasse, sollte dann ja der Aufruf in der DOS-Box zu sehen sein. Es öffnet sich aber nichts? Somit ist das so auch nicht richtig.

test.bat:

@echo off
echo Test....
pause

Muss ich vielleicht der VM den Backup-Agent des Windows-AMS manuell zuweisen? Dann könnte das vielleicht funktionieren.
Alles sehr merkwürdig...

Acronis Program Manager
Posts: 22
Comments: 3098

Hi Sanches,

Interactive batch files are not supported. Instead of "pause" you should make your batch script to run some non-interactive command, for example "copy c:\temp\test.txt c:\temp\test2.txt". And yes in case of Windows Agent for VMware - the pre/post command will be executed on this Windows machine side (not inside the VM), so it should work.

Thank you.

--

Best regards,

Vasily

Acronis Virtualization Program Manager

Forum Member
Posts: 14
Comments: 22

Hello, it's not working with VMware ESXi 6.0:

  • Product Version(s):
    VMware Consolidated Backup 1.5.x
    VMware ESX 3.5.x
    VMware ESX 4.0.x
    VMware ESX 4.1.x
    VMware ESXi 3.5.x Embedded
    VMware ESXi 3.5.x Installable
    VMware ESXi 4.0.x Embedded
    VMware ESXi 4.0.x Installable
    VMware ESXi 4.1.x Embedded
    VMware ESXi 4.1.x Installable
    VMware ESXi 5.0.x
    VMware ESXi 5.1.x
    VMware ESXi 5.5.x
Acronis Program Manager
Posts: 22
Comments: 3098

It must work for 6.0 too - there are no changes here or notes that the functionality has been removed in 6.0. You can try it by adding the scripts inside the VM and taking quiesced snapshot of it manually from vSphere client.

Forum Member
Posts: 14
Comments: 22

Hello, No - it does not work.

My real problem is the following. For one VM, we can't create a backup by Acronis. The reason is as follows. The system time of the VM is artificial from us again and again on a specific window of time (2014) per batch reset. This is necessary for several reasons. If the actual time and date is set to the VM, Acronis provides normal without error message. Thus, the cause is clear. Only how can I save the VM with incorrect system time? The wrong system time must remain and must not be too short on the actual time and date. What can I do? Thank you.

Acronis Program Manager
Posts: 22
Comments: 3098

Hi Sanches,

I've just completed tests on ESXi 6.0 running a VM with Windows 2012 inside: the scripts actually work properly including pre-freeze and post-thaw operations. See several screen shots illustrating what I've done to confirm this (created c:\windows\pre-freeze-script.bat and put required commands there, then created quiesced snapshot). Hope it helps to resolve your original issue.

Thank you.

--

Best regards,

Vasily

Acronis Virtualization Program Manager

Attachment Size
328149-125515.png 251.37 KB
328149-125518.png 215.53 KB
328149-125521.png 271.77 KB
328149-125524.png 273.52 KB
328149-125527.png 85.83 KB
Forum Member
Posts: 14
Comments: 22

That's right. But I don't create a snapshot by "VMware vSphere Client".
I need the function by Acronis Backup. And so it does not work. This is my problem. So I can not solve so my real problem (see above - the problem with the system time on the VM).

Acronis Program Manager
Posts: 22
Comments: 3098

Hi Sanches,

Acronis Backup always uses VMware snapshot to capture the state of the VM and put it into backup. In other words a quiesced snapshot will be created in any case when you perform a backup of a VM using virtual appliance. The whole backup sequence looks as follows (simplified):

1) The backup task is configured and required VMs are selected for backups

2) Acronis Backup sends a command to ESXi host to trigger VM snapshot creation (with quiesced=on, memory=off parameters by default)

3) ESXi host creates a snapshot of the VM

4) Acronis Backup opens the created snapshot using standard VMware API (accesses the base .vmdk disks) and reads data from them from beginning to the end.

5) Acronis Backup sends a command to ESXi host to remove the snapshot.

This means that your scripts will be executed automatically inside the VM during the backup (at stage 3) if you define them.

P.S. We're planning to add functionality to pass the pre/post commands defined in Acronis GUI into the VM guest OS (created required files automatically in proper folders), but on the backend it will be still using this exact native VMware Tools functionality. In other words this feature will be a pure GUI one.

Thank you.

--

Best regards,

Vasily

Acronis Virtualization Program Manager

Forum Member
Posts: 14
Comments: 22

It has been known to me. But it's crazy.
Create a snapshot by "VMware vSphere Client" everything is ok, and the batch file is run.
When I start the backup job in Aconis, the batch file will not run and the backup will fail.
Have you manually set once the system time from the VM to the year 2014? Then again, test a backup with Acronis. That doesn't work!

Acronis Program Manager
Posts: 22
Comments: 3098

Hi Sanches,

Can you please send me the details of your batch file in a forum private message (Send PM), so that I can try reproducing the problem and see what might be wrong? Also please let me know how exactly backup fails? Remember that you don't need to define pre/post commands in the backup task settings - the scripts must be only present inside the VM in c:\windows\pre-freeze-script.bat file.

Thank you.

--

Best regards,

Vasily

Acronis Virtualization Program Manager

Forum Member
Posts: 14
Comments: 22

Yes, now you have pm.

Forum Member
Posts: 14
Comments: 22

The solution is so simple and easy!
It's almost embarrassing to talk about.
Also a Windows agent directly into the VM can be installed. No separate license is necessary. The license is queried by the ESXi host.
And no matter the Windows agent is the time and the date.
Thus, the VM can now finally be secured with Acronis.

Thanks to Vasily, who has really sought.

~ closed ~

Acronis Program Manager
Posts: 22
Comments: 3098

Hi Sanches,

Thank you for the confirmation, I'm glad to hear that my suggestions helped. Below I will summ up what happened:

Problem:

After adding commands to c:\windows\pre-freeze-script.bat + c:\windows\post-thaw-script.bat batch files to run custom scripts inside VM before backup the quiesced snapshot (and therefore backup as well) of the VM starts to fail with the following error:

An error occurred while taking a snapshot: Failed to quiesce the virtual machine.

Cause:

Quiesced snapshot fails if the batch file execution completes with non-zero %errorlevel% (this appears to be by-design behavior of VMware processing pre/post commands inside VM). To check the value of %errorlevel% variable one can execute the batch file and run "echo %errorlevel%" command from CMD. See attached screen shot "errorifscriptfails.png".

Solution:

The solution is to enforce the batch execution to complete with %errorlevel% = 0 (which means successful execution). This was achieved by adding 2 harmless strings into the end of the batch file (in my case it was "net stop PlugPlay" + "net start PlugPlay". See attached screen shot "successprepost.png".

As the result quiesced snapshot will complete successfully and therefore backup will also be successful.

Thank you.

--

Best regards,

Vasily

Acronis Virtualization Program Manager

Attachment Size
329400-125677.png 266.83 KB
329400-125680.png 272.75 KB