18. 2. 2013

Add cron Job to VMware ESXi 5.1

1. You can add your commands to file /var/spool/cron/crontabs/root
Example of my /var/spool/cron/crontabs/root :

.......

#-------------------------------------------------
# MK 22.02.2013
# AD4CZ
5 0 * * * vim-cmd vmsvc/power.shutdown 35 2>&1
25 2 * * * vim-cmd vmsvc/power.on 35 2>&1
#C-EMsrv1
7 0 * * * vim-cmd vmsvc/power.shutdown 40 2>&1
30 2 * * * vim-cmd vmsvc/power.on 40 2>&1
#--------------------------------------------------


BUT ... after reboot your commands are away !

So, you have to edit file /etc/rc.local.d/local.sh
 ... and add your commands.


#-----------------------------------------

# MK 22.2.2013
/bin/kill $(cat /var/run/crond.pid)
/bin/echo "5 0 * * * vim-cmd vmsvc/power.shutdown 35 2>&1" >> /var/spool/cron/crontabs/root
/bin/echo "25 2 * * * vim-cmd vmsvc/power.on 35 2>&1" >> /var/spool/cron/crontabs/root

/usr/lib/vmware/busybox/bin/busybox crond

#-----------------------------------------


Add cron Job to VMware ESX/ESXi
http://blog.waldrondigital.com/tag/esxi-5-1/


MK Pozn.: List of all VMs

vim-cmd vmsvc/getallvms

Žádné komentáře: