User Tools

Site Tools


software:nut:stagedshutdown

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

software:nut:stagedshutdown [2025/04/14 23:05] – created rodolicosoftware:nut:stagedshutdown [2025/04/14 23:24] (current) rodolico
Line 3: Line 3:
 Clients can be configured to shut down at different times. As far as I can tell, there is no facility for the NUT server to tell clients to shut down at different times, but each client can be configured separately. Thus, your YouTube player can go down after a minute, your power hungry workstation when the battery is 50% gone, and your router just before the UPS goes into sleep mode. Clients can be configured to shut down at different times. As far as I can tell, there is no facility for the NUT server to tell clients to shut down at different times, but each client can be configured separately. Thus, your YouTube player can go down after a minute, your power hungry workstation when the battery is 50% gone, and your router just before the UPS goes into sleep mode.
  
-===== How to configure a client =====+===== Set up actions in upsmon.conf =====
  
 Edit upsmon.conf and add the following lines Edit upsmon.conf and add the following lines
Line 15: Line 15:
  
 **Note:** You must put the path in quotes. **Note:** You must put the path in quotes.
 +
 +==== Values for NOTIFYFLAG ====
 +
 +NOTIFYFLAG can have an action of one or more of
 +  * SYSLOG - put a message in syslog
 +  * WALL - Use //wall// to send a message to all logged in users
 +  * EXEC - Run the script defined in NOTIFYCMD
 +  * IGNORE - don't do anything. Do not put any other flags on this line.
 +
 +Note that NOTIFYCMD must be able to handle the flag in question if EXEC is set. Multiple actions can be performed on one flag by separating them with the plus sign, ie SYSLOG+WALL+EXEC will put a message in syslog, send out a wall message, and run the NOTIFYCMD script
 +
 +Flags can be one of the following. By default, they are set up for SYSLOG+WALL
 +
 +  * ONLINE - UPS is (back) online
 +  * ONBATT - UPS is on battery
 +  * LOWBATT - UPS is on battery and the battery has gone under a UPS specific value (10%)
 +  * FSD - NUT has started a Forced Shut Down
 +  * COMMOK - Communication has been reestablished
 +  * COMMBAD - Communication with the UPS has been lost
 +  * SHUTDOWN - UPS is in a shutdown state
 +  * REPLBATT - UPS thinks the batteries need to be replaced
 +  * NOCOMM - No communication with the UPS
 +  * NOPARENT - This script has no parent. Generally happens during a shutdown
 +  * CAL - The UPS is in calibration mode
 +  * NOTCAL - The UPS has returned from calibration mode
 +  * OFF - The UPS I is off
 +  * NOTOFF - The UPS is back on
 +  * BYPASS - The UPS is in bypass mode
 +  * NOTBYPASS - The UPS has returned from bypass mode
 +
 +
 +==== Create script to run on event ====
  
 Now, create a new file in /usr/local/etc/nut named notifycmd. The path doesn't matter, and neither does the name, it just must match the last line (NOTIFYCMD). Now, create a new file in /usr/local/etc/nut named notifycmd. The path doesn't matter, and neither does the name, it just must match the last line (NOTIFYCMD).
Line 71: Line 103:
 <code bash> <code bash>
 # how long can the UPS stay up # how long can the UPS stay up
-upsc ups1@10.111.111.33 battery.runtime+upsc ups1@192.168.1.100 battery.runtime
 # how much time has it been on already # how much time has it been on already
-upsc ups1@10.111.111.33 battery.runtime.elapsed+upsc ups1@192.168.1.100 battery.runtime.elapsed
 </code> </code>
  
 ===== Links ===== ===== Links =====
   * https://srackham.wordpress.com/2013/02/27/configuring-nut-for-the-eaton-3s-ups-on-ubuntu-linux/   * https://srackham.wordpress.com/2013/02/27/configuring-nut-for-the-eaton-3s-ups-on-ubuntu-linux/
software/nut/stagedshutdown.txt · Last modified: 2025/04/14 23:24 by rodolico