Changes

From SME Server
Jump to navigationJump to search
Line 186: Line 186:  
==Modifying shutdown time delay==
 
==Modifying shutdown time delay==
   −
The following changes to NUT configuration will shut down the server a specified time after receiving the "on battery" signal (the example given is for 2 minutes).
+
By default nut will issue a shutdown command as soon as it received a low battery event from the UPS. There may be instances and installation configurations that require a shutdown sooner or other events with timed or schedules outcomes. See the '''man''' pages etc for further info and example situations.
   −
To create a timed shutdown before the BATTLOW signal is received, it is necessary to configure upssched and have a script handle the UPS events (upsmon cannot do this).
+
In essence the '''upsmon''' program monitors the relevant UPS and for each '''NOTIFYFLAG''' event in '''upsmon.conf''' takes immediate action as defined. In order to delay or schedule any actions, the events need to be passed to '''upssched''' which can set timers and schedule events.
config setprop nut status enabled
  −
config setprop nut Model megatec_usb
  −
config setprop nut Type auto
     −
Create and edit a custom template
+
The following changes to standard SME Server NUT configuration will shut down the server a specified time after receiving the "on battery" signal (the example given is for 2 minutes). It assumes you already have an enabled and working NUT configuration and UPS
 +
 
 +
To create a timed shutdown before the '''BATTLOW''' signal is received, it is necessary to configure '''upssched''' and have a script handle the UPS events (upsmon cannot do this).
 +
 +
First we need to create a new custom template directory:
 
  mkdir -p /etc/e-smith/templates-custom/etc/ups/upsmon.conf
 
  mkdir -p /etc/e-smith/templates-custom/etc/ups/upsmon.conf
  pico -w /etc/e-smith/templates-custom/etc/ups/upsmon.conf/NOTIFYCMD
+
  cd /etc/e-smith/templates-custom/etc/ups/upsmon.conf
   −
Add the following:
+
Create and edit a new file called 'NOTIFYCMD' with the following content:
 
  NOTIFYCMD /usr/sbin/upssched
 
  NOTIFYCMD /usr/sbin/upssched
   −
Save & exit
+
Now create another a custom template directory
Ctrl o
  −
Ctrl x
  −
 
  −
Create and edit a custom template
   
  mkdir -p /etc/e-smith/templates-custom/etc/ups/upssched.conf
 
  mkdir -p /etc/e-smith/templates-custom/etc/ups/upssched.conf
  pico -w /etc/e-smith/templates-custom/etc/ups/upssched.conf/01CONFIG
+
  cd /etc/e-smith/templates-custom/etc/ups/upssched.conf
   −
Add the following:
+
Create and edit a new file called '01CONFIG' with the following content:
 
  CMDSCRIPT /sbin/e-smith/nutUPS.cmd
 
  CMDSCRIPT /sbin/e-smith/nutUPS.cmd
 
  PIPEFN /tmp/upspipe
 
  PIPEFN /tmp/upspipe
Line 225: Line 222:  
to how many seconds after ONBATT signal you want to shut down
 
to how many seconds after ONBATT signal you want to shut down
   −
Save & exit
+
Create and edit a new script file at:
Ctrl o
+
  /sbin/e-smith/nutUPS.cmd
Ctrl x
  −
 
  −
Create the script
  −
  pico -w /sbin/e-smith/nutUPS.cmd
     −
Add the following:
+
Add the following content:
    
  #! /bin/sh
 
  #! /bin/sh
Line 272: Line 265:       −
Create a custom template
+
Create a custom template directory
 
  mkdir -p /etc/e-smith/templates-custom/etc/sudoers/30nut
 
  mkdir -p /etc/e-smith/templates-custom/etc/sudoers/30nut
 +
cd /etc/e-smith/templates-custom/etc/sudoers/30nut
   −
Add the following
+
Create and edit a new file called '30nut' with the following content:
 
  nut  ALL=NOPASSWD: ALL
 
  nut  ALL=NOPASSWD: ALL
   Line 281: Line 275:  
  signal-event post-upgrade
 
  signal-event post-upgrade
 
  signal-event reboot
 
  signal-event reboot
      
==Aditional Information==
 
==Aditional Information==

Navigation menu