GhettoVBC, ESXi 5.5 & Crontab

By | October 23, 2014
# vi /etc/rc.local.d/

Make the contents something similar to the following…


# 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.
/bin/kill $(cat /var/run/ # Gets the cron service pid and simply kills it.
# The next line writes a typical cron line to the crontab
/bin/echo "0 3 * * * /vmfs/volumes/datastore2/scripts/ghettoVCB/ -a > /vmfs/volumes/datastore2/backups/ghettoVCB-backup-\$(date +%Y-%m-%d-%H%M%S).log" >> /var/spool/cron/crontabs/root

# Finally we start the cron service again
/usr/lib/vmware/busybox/bin/busybox crond
exit 0

The $(date) is escaped so that the command doesn’t execute during boottime and always log to the a file with the date and time of the last reboot!

Reboot to be sure it’s worked as expected.