Project

General

Profile

Feature #16674

Allow customization of the shutdown command UPS/NUT uses to take down the system

Added by Zach Brown about 3 years ago. Updated over 1 year ago.

Status:
Resolved
Priority:
Nice to have
Assignee:
Jan Stevenson
Category:
OS
Target version:
Estimated time:
0.50 h
Severity:
New
Reason for Closing:
Reason for Blocked:
Needs QA:
Yes
Needs Doc:
Yes
Needs Merging:
Yes
Needs Automation:
No
Support Suite Ticket:
n/a
Hardware Configuration:

Description

In my case (and other's from what I have seen) it would nice to customize via the GUI the command that the NUT tools use to shutdown the system. I have a script that nicely shuts down all of the embedded VM's relying on my FreeNAS NFS share, then it shuts down FreeNAS that's running as a VM.

I submitted a pull request #183
It was merged into master https://github.com/freenas/freenas/commit/8c9cf137a8e094d88c7f4b020662f9ec1a3be552

It would be super awesome if it could make it into the next release. :-)

History

#1 Updated by Zach Brown about 3 years ago

#2 Updated by Jakub Klama about 3 years ago

  • Status changed from Unscreened to Investigation

#3 Updated by Zach Brown about 3 years ago

I didn't realize I put this under the FreeNAS 10 bug area. This patch (I'm assuming anyhow) won't work with 10

#4 Updated by Jordan Hubbard about 3 years ago

  • Project changed from 9 to FreeNAS
  • Category changed from 193 to 76
  • Assignee changed from Jakub Klama to Kris Moore

#5 Avatar?id=14398&size=24x24 Updated by Kris Moore about 3 years ago

  • Status changed from Investigation to 19
  • Assignee changed from Kris Moore to Jan Stevenson
  • Target version set to 9.10.1-U1

Jan,

Can you give this a whirl on the latest MASTER build? If it appears functional, we can send to VB to queue it up for 9.10.1-U1

#6 Updated by Vaibhav Chauhan almost 3 years ago

any update on this item ?

#7 Updated by Dru Lavigne almost 3 years ago

For doc purposes, will this be making it into U1?

#8 Updated by Zach Brown almost 3 years ago

Pleeeasseee.. :-)

#9 Updated by Jan Stevenson almost 3 years ago

On it. I'll update here tomorrow.

#10 Avatar?id=14398&size=24x24 Updated by Kris Moore almost 3 years ago

  • Target version changed from 9.10.1-U1 to 9.10.2

#11 Updated by Jan Stevenson almost 3 years ago

Update on this:

  • have set up a UPS and connected it to a FreeNAS
  • have been able to successfully start up the UPS service on the FN using the usbhid-ups driver
  • presently getting the nut tools installed and working on a fbsd client in order to test out the UPS interaction with the FreeNAS
  • also reviewed the diff changes and verified that the new field is present in the UI->Services->UPS and that the schema migration code includes the new field as well
  • next up is to figure out how to use the NUT tools and then test the interaction between calling a user defined shutdown command and the UPS device

#12 Updated by Jan Stevenson almost 3 years ago

After getting all the client side NUT tools to work, I verified that sending a fsd request to the upsmon process does call out to the script defined in the UI under Services->UPS->Shutdown Command.

The script I used:

#!/bin/sh
echo "got shutdown request from upsmon" | wall

and with a 'upsmon -c fsd' call I saw the wall show up everywhere.

This action got logged to ups.log as:

20160923 144005 100 120.9 0.0 [FSD OL] NA NA

Monitoring then shows the UPS status to be:

root@jsteve-vm-fbsd:~ # upsc fn-ups@10.212.3.135:3493|grep ups.status
ups.status: FSD OL

So my conclusion is that the SHUTDOWN command that is specified in UI does indeed get plumbed through to the UPS monitor running on the FreeNAS (upsmon). What is unclear is that after the side script/command gets called and completes then the next action should be to do continue on with the rest of shutdown, i.e to do the basic '/bin/shutdown -p now'. And that is not happening.

#13 Updated by Zach Brown almost 3 years ago

Yah, that was kind of the point.

If you want it to shutdown the system you should include the shutdown command in the script.

In my case I run a script to shutdown all freenas dependant VMS and then use the hypervisor shutdown command to shutdown freenas vs actually shutting it down with a command.

#14 Updated by Jan Stevenson almost 3 years ago

Thanks Zach. It was unclear to me if the shutdown would then get called automatically in succession by upsmon. For instance given this in upsmon.conf, for example:

NOTIFYFLAG SHUTDOWN SYSLOG+EXEC

It seemed that a different monitoring event sent via upssched would trigger this later.

I can see where adding the actual call to 'shutdown' of the FreeNAS box to script defined by SHUTDOWNCMD in upsmon.conf file could get the job done, but it seemed like it would be automatic later based on a different event?

#15 Updated by Zach Brown almost 3 years ago

I'm pretty sure the command is intended to be the one to shutdown the box. It gives the user the flexibility to do something first or the shutdown command may not be consistent from one box/distro to another. It works perfectly for me as I have set the shutdown to commence when there is about 10 minutes of runtime left in my ups. My script issues the shutdown command to all the VMS that are dependant on freenas and when they are all down it issues the shutdown command to freenas. I have freenas running on VMware serving NFS back to VMware to store virtual disks. Everything is shut down in the right order so I don't trash VMS sitting on freenas by shutting it down too soon. Once this is in, I'll contribute the script. It actually works with freenas' built in VMware support.

#16 Updated by Zach Brown almost 3 years ago

Is there a reason this wouldn't be put into 9.10.1-U3 instead of the current target of 9.10.2?

#17 Avatar?id=14398&size=24x24 Updated by Kris Moore almost 3 years ago

Sure, this is a new feature. The -UX updates are bugfixes only, features all land in new .X releases. Helps avoid breaking things and do all the QA for new features at once.

#18 Updated by Vaibhav Chauhan over 2 years ago

fix is already in freenas:9.10.2-STABLE repo can this be marked RFR ?

#19 Updated by Jan Stevenson over 2 years ago

IMO - yes

#20 Updated by Jan Stevenson over 2 years ago

  • Status changed from 19 to Ready For Release

#21 Updated by Dru Lavigne over 1 year ago

  • Status changed from Ready For Release to Resolved

Also available in: Atom PDF