For a english version scroll down!

Heute habe ich noch einen Leckerbissen: Ein Script für ESX3/ESX4 mit dem einfache, automatisierte VCB Backups möglich sind.
Über die Annotations kann die Variable DO_BACKUP als einfacher Text für jede VM gesetzt werden, z.B. DO_BACKUP=DAILY.
Das Skript liest diese Anmerkungen aus und sichert die Maschine dann täglich. Aber genug der Rede, hier ist der Download Link:

esx3_4_backup.sh

Voraussetzungen/Infos:
-es gibt die Methoden ONCE, DAILY, WEEKLY und MONTHLY
-DO_BACKUP muss immer am Ende der Annotations stehen. Also z.B. „Nur eine Testmaschine, blah blah blah, DO_BACKUP=WEEKLY“
-Annotations dürfen keine Sonderzeichen (ß,ü,ä,ö, usw) enthalten
-je nach Größe der Backup-LUNs muss die default Vorhaltezeit angepasst werden, sonst laufen die LUNs voll.
-es müssen die UUIDs für _alle_ Produktions-LUNs und Backup-LUNS angepasst werden
-über die Variable ESX müssen alle Hostnamen der ESXe richtig gesetzt sein
-remote SSH login für alle ESXe muss über ein root Zertifikat möglich sein. Default ist /root/.ssh/id_rsa

Ganz wichtig: bevor das Skript ausgeführt wird, sollte DEBUG=1 gesetzt werden. Außerdem solltet Ihr das Skript durchlesen, verstehen und auf eure Bedürfnisse anpassen! Das Skript löscht Dateien auf LUNs auf Konsolenebene, also OBACHT!
1. LESEN
2. VERSTEHEN
3. ZURÜCK ZU 1.

Ich lehne natürlich jegliche Haftung für gelöschte Daten ab. Benutzung auf eigene Gefahr!
(Für alle Schlaumeier: Ja, man kann das besser machen, awk überall durch cut ersetzen, sed zusammenziehen, blablabla. Help yourself.)

English version:

Today I have another gimmick for you: A script for ESX3/ESX4 which makes creating automated VCB backups very easy.
You can set a variable DO_BACKUP as text in the VMs annotations, e.g. DO_BACKUP=DAILY.
The script then reads the annotations, finds the variable and executes the desired vcbbackup.
Here is the download link:

esx3_4_backup.sh

Requirements/Infos:
-you can use backup methods ONCE, DAILY, WEEKLY und MONTHLY
-DO_BACKUP has to be defined at the end of the annotations, e.g. „This is a test machine, blah blah blah, DO_BACKUP=WEEKLY“
-annotations  must not contain special characters (ß,ü,ä,ö, etc)
-depending on the size of your backup LUNs you have to change the default keep times or your LUNs will end up with no space left.
-you have to set the correct UUIDs for  _all_ production and backup LUNS
-variable ESX must be set correctly to contain all ESX hostnames
-remote SSH login must be working for all ESX using a root certificate. Default is /root/.ssh/id_rsa

Very important: before you execute the script you should set DEBUG=1. Additionally you should read, understand and modify the script to fit your needs! The script deletes files directly from LUNs, be careful!
1. READ
2. UNDERSTAND
3. BACK TO 1.

This script comes without any warranty. Use at own risk!
(For all wise guys: yes you can solve this better, replace all awk with cut, shorten the seds, blablabla. Help yourself.)