TL;DR How can I send SSH commands to another system during the FreeNAS shutdown process?
Cyberpower CP1500AVRLCD via USB
I've come to the point in my FreeNAS/ESXi build of setting up my UPS. I have the UPS configured in FreeNAS and it will power down properly when I pull the power from my UPS. Moving on to the ESXi server I'd like to have all the powered-on guests be suspended, or failing that powered off, before the host shuts down and before FreeNAS shuts down.
I've done all sorts of Googling for a solution and I almost have it. I can feel it. Found a script here that with a little editing does exactly what I want. I have setup public/private key ssh login to ESXi and I can execute the script from a FreeNAS command line like so:
I think I'll have this solved if I can get that command into the FreeNAS shutdown process and thought that adding a command to "Tasks>Init/Shutdown Scripts" would get me what I want, but it doesn't seem to be working.
So, am I on the right track here? How can I get this command to execute when I need it to? Ideally, I'd like the FreeNAS shutdown to wait on the script to complete but with a maximum execution time so if the script hangs FreeNAS doesn't wait indefinitely to shutdown. The script itself has some basic checking so that it doesn't end up waiting forever for guests to suspend or power down.
Is there a better way? I've spent hours over the last two days trying all sorts of solutions found on the Google and haven't found a completely working one yet. Biggest problem with most of the other ways I've tried is that the free ESXi 6.0 doesn't seem to suspend guests when shutdown from CLI no matter how I have the Virtual Machine Startup/Shutdown properties configured. Yes, I have VMware Tools installed.
Cyberpower CP1500AVRLCD via USB
I've come to the point in my FreeNAS/ESXi build of setting up my UPS. I have the UPS configured in FreeNAS and it will power down properly when I pull the power from my UPS. Moving on to the ESXi server I'd like to have all the powered-on guests be suspended, or failing that powered off, before the host shuts down and before FreeNAS shuts down.
I've done all sorts of Googling for a solution and I almost have it. I can feel it. Found a script here that with a little editing does exactly what I want. I have setup public/private key ssh login to ESXi and I can execute the script from a FreeNAS command line like so:
Code:
ssh root@192.168.40.31 /vmfs/volumes/nas01-iscsi/scripts/esxidown.sh
I think I'll have this solved if I can get that command into the FreeNAS shutdown process and thought that adding a command to "Tasks>Init/Shutdown Scripts" would get me what I want, but it doesn't seem to be working.
So, am I on the right track here? How can I get this command to execute when I need it to? Ideally, I'd like the FreeNAS shutdown to wait on the script to complete but with a maximum execution time so if the script hangs FreeNAS doesn't wait indefinitely to shutdown. The script itself has some basic checking so that it doesn't end up waiting forever for guests to suspend or power down.
Is there a better way? I've spent hours over the last two days trying all sorts of solutions found on the Google and haven't found a completely working one yet. Biggest problem with most of the other ways I've tried is that the free ESXi 6.0 doesn't seem to suspend guests when shutdown from CLI no matter how I have the Virtual Machine Startup/Shutdown properties configured. Yes, I have VMware Tools installed.