I had a need to run ESXTOP at a specific time on a couple hosts but didn’t want to be awake to start it. I’ve done this in the past on ESX and as a frequent Linux user I thought this would be quite simple. Just type “crontab -e” and add the command and proper start time. Not so fast as there is no “crontab” command in ESXi (busybox).
After using the global documentation repository (Google), without much luck, I searched the ESXi file system and found the /var/spool/cron/crontabs/root file. I viewed the file and it looked like a normal crontab file. I tried to modify it but was unable to save changes with the standard “:wq” command. I then searched on the file and found KB article 1033346. Turns out you have to do a “:wq!” to save the file.
Next you need to stop the current crond process by locating its PID number:
cat /var/run/crond.pid
Kill the process:
kill -HUP pid##
Once that’s done start crond again:
ESXi 5.0: /bin/busybox/crond
ESXi 5.1: /usr/lib/vmware/busybox/bin/busybox crond
I prefer this method to getting up in the middle of the night and manually starting ESXTOP to monitor a host for 1 hour!!!
There ought to be an esxcli.
Also you could run resxtop from a Linux box with cron as well.
Via esxcli you can schedule same tasks that you can from VIC/web client. PowerCLI would work as well but in this use case I was supporting a client that didn’t have a system I could run PowerCLI from in the middle of the night. Couldn’t do it via VMA either as the cron job didn’t like using passthrough authentication. When I ran the command manually it worked. When cron job ran it waited for credentials.