mcba3n Posted September 2, 2021 Share Posted September 2, 2021 Hi folks, I'm trying to figure out a way to accomplish the following, and looking for some expert help to guide me on my way. I'll outline the scenario and where I am looking for some help. Background - My wife recently upgraded her computer, opting for an M1 iMac (against my advice, her choice and happy wife = happy life) - Her old machine has become my new Unraid machine, as it is much better than the 12 year old Athlon II I had running previously, and it included my old GTX1080 video card (migration was a breeze - my 20TB array moved over without any issues) - Using the guide from dboris, I setup an NHOS VM, which is fully operational and mining away right now - My local area suffers from frequent brown outs and black outs, usually brief, but to protect my array my server is connected to a UPS - This UPS also has my core network connected to it (modem, switch, router, 1 access point, a couple raspberry pi's) as well, so that I have time to save my work to the network and recover gracefully if the power outage is extended past 10 minutes or so - Right now, I have the NUT plugin installed to manage my UPS - If there is a power outage, and the battery life drops below 30% on my UPS, the whole array will shut down, leaving me with about 30 minutes of battery on the network equipment Where I need help - What I'd like to do, is have my VMs shut down if the power outage lasts more than 10 seconds, so that my array can still stay online much longer, given that NHOS is eating up an additional 120W with my GPU, and also a windows VM that is always busy eating up lots of CPU as well - I've come across these shell commands that do the trick Quote root@unraidserver:~# virsh list Id Name State ----------------------------- 3 Nicehash OS running root@unraidserver:~# virsh shutdown "Nicehash OS" Domain Nicehash OS is being shutdown root@unraidserver:~# virsh start "Nicehash OS" Domain Nicehash OS started - Where I need help: How can I get the command "virsh shutdown <VM name>" to execute only when the UPS changes state to ONBATT for more than 10 seconds? Also, I would want it to spin the VM back on with "virsh start <VM name>" once power is restored? - I've come across the NUT guide which should show me how to do this, but it's a bit over my head Worst case, I will just have to live with the shorter lifespan of the array on battery power, but this would really help me avoid power cycling the whole server for the majority of the power challenges I have, which rarely last more than 10 minutes Thank you for your consideration and reading!!!! Unraid Machine Details: ASRock Z87 Killer | Intel i7 4790K | 16 GB DDR3 1600 | ASUS GTX 1080 | 20GB Array with 1TB Cache NVME Quote Link to comment
itimpi Posted September 2, 2021 Share Posted September 2, 2021 Normally a much easier solution is to install UPS client software within the VM that is configured to connect via the network to the UPS software running at the UnRaid level and set to shutdown the VM from within the VM. In other words take the same approach as one would take for a physical PC. Quote Link to comment
mcba3n Posted September 2, 2021 Author Share Posted September 2, 2021 Thank you itimpi! NicehashOS is running on a super stripped down version of linux, TinyCore. I have scoured the support forums for TinyCore and there are no UPS controls built in - I would have to compile it myself.... which looks like a much larger mountain to climb. I don't even know where to start with compiling packages.... though I have super user access to my server, I am far from a "super" linux user. Thank you for your time 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.