Script personalizzato per i miei server vmware con copiasu NAS NFS già montato su ogni Host di VMWARE

Nel file vms_to_backup devono essere inseriti i nomi delle macchine su cui lo script eseguirà il backup

#!/bin/sh

# local configuration options

# Note: modify at your own risk! If you do/use anything in this
# script that is not part of a stable API (relying on files to be in
# specific places, specific tools, specific output, etc) there is a
# possibility you will end up with a broken system after patching or
# upgrading. Changes are not supported unless under direction of
# VMware support.
mkdir /opt/ghetto
cp /vmfs/volumes/nas-ds-3tb/vmware_script/esx2/ghettoVCB.conf /opt/ghetto/ghettoVCB.conf
cp /vmfs/volumes/nas-ds-3tb/vmware_script/esx2/ghettoVCB.sh /opt/ghetto/ghettoVCB.sh
cp /vmfs/volumes/nas-ds-3tb/vmware_script/esx2/vms_to_backup /opt/ghetto/vms_to_backup
chmod +r+w+x /opt/ghetto/ghettoVCB.sh
chmod +r+w /opt/ghetto/vms_to_backup
chmod +r+w /opt/ghetto/ghettoVCB.conf
chmod +w+r /var/spool/cron/crontabs/root
cp /var/spool/cron/crontabs/root /var/spool/cron/crontabs/root.backup
chmod 644 /var/spool/cron/crontabs/root.backup
echo "0 3 * * 0 /opt/ghetto/ghettoVCB.sh -f /opt/ghetto/vms_to_backup -g /opt/ghetto/ghettoVCB.conf" >> /var/spool/cron/crontabs/root.backup
mv /var/spool/cron/crontabs/root.backup /var/spool/cron/crontabs/root
/bin/kill $(cat /var/run/crond.pid)
crond
cp /vmfs/volumes/nas-ds-3tb/vmware_script/esx2/smtp.xml /etc/vmware/firewall/smtp.xml
esxcli network firewall refresh
exit 0

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *