Kaltar Posted May 20, 2019 Share Posted May 20, 2019 Hi Guys, I'm running my Unraid as a VM on ESXi, and I want to be able to schedule a daily shutdown of the server. The reason for that is that it uses quit alot of power, like about 175w when idle, and were I live 1kw costs about 0.34$ So running the server 24/7 would be almost 1.5$ a day I can Schedule a shutdown in unraid just fine, but how do I schedule a shutdown of the ESXi. I don't have vCenter, so it is just a single host. Is it even possible ? Quote Link to comment
StevenD Posted May 20, 2019 Share Posted May 20, 2019 PowerCLI stop-vmhost https://pubs.vmware.com/vsphere-51/index.jsp?topic=%2Fcom.vmware.powercli.cmdletref.doc%2FStop-VMHost.html Quote Link to comment
doron Posted May 20, 2019 Share Posted May 20, 2019 Very possible, in a variety of ways, depending on what exactly you want to do and on your personal taste. To automate, you can edit the ESXi root crontab, which lives in /var/spool/cron/crontabs/root in ESXi (access it via the ESXi CLI). There, you can add a crontab entry to do the shutdown at your designated time. Essentially, /sbin/shutdown.sh and /sbin/poweroff will do the trick. Now that's not exactly what you are trying to do; you want Unraid to do an orderly shutdown, before ESXi goes down. This can be achieved via several different approaches: 1. If you have the VMware tools plugin installed in Unraid, and Unraid is part of the autostart VMs set, then /sbin/shutdown.sh will trigger an orderly shutdown as part of the host shutdown. 2. You can have Unraid auto-shutdown at (say) 1 am, and have ESXi auto-shutdown at (say) 1:10 am. Make sure clocks are synced... 3. You can have Unraid initiate its own shutdown and the ESXi shutdown (via SSH CLI), simultaneously. 4. You can use PowerCLI (as @StevenD just wrote while I was typing this) from a Windows host where PowerCLI is installed. You could probably trigger an Unraid shutdown, wait some time for it to complete, then do the stop-vmhost. These are just examples, obviously. Hope this helps. Quote Link to comment
Kaltar Posted May 21, 2019 Author Share Posted May 21, 2019 8 hours ago, doron said: Alot of good Suggestions Hey Guys, thanks for the help, I think I found the solution that fits me. I will get the VMware tools plugin install in Unraid. Then I'll use a crontab job to initiate the shutdown. I found a site explaining how to set up a crontab job here: http://www.jules.fm/Logbook/files/add_cron_job_vmware.html That should hopefully take care of my "problem" Then I can schedule the poweroff and poweron in my smartplug Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.