Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

ups and shutdown script unraid 4.5 problem

Featured Replies

hi,

 

i bought a ups from apc last week. now i try to install the unit.

 

everthing is connect und the unraid server 4.5 can see the usb

connected apc 500.

 

i replaced in my go file this

 

#!/bin/bash

# Start the Management Utility

/usr/local/sbin/emhttp &

LOGSAVE=30 installpkg /boot/packages/powerdown-1.02-noarch-unRAID.tgz

sysctl -w kernel.poweroff_cmd="/sbin/powerdown"

 

installpkg /boot/packages/apcupsd-3.14.8-i486-1_rlw.tgz

sed -i -e "s/^TIMEOUT 0/TIMEOUT 100/" /etc/apcupsd/apcupsd.conf

cp  /boot/apcupsd.conf  /etc/apcupsd/

/sbin/apcupsd

 

#Now, put into place the shutdown script replacement

echo "/sbin/powerdown" >/etc/apcupsd/doshutdown

echo "exit 99" >>/etc/apcupsd/doshutdown

chmod 755 /etc/apcupsd/doshutdown

 

---

 

? the maschine is shuting down after 100 seconds but

what lines can i delete and are the command for

a safe shutdown the array in these lines above.

 

i'm sorry but i'm still learning all these unraid and linux code. br hyla

? the maschine is shuting down after 100 seconds but

what lines can i delete

I would delete the line where you copy the apcupsd.conf file from /boot to the one in /etc/apcupsd after editing the one in /etc/apcupsd to change the timeout to 100 seconds.  The copy would undo the edit you just made.

and are the command for

a safe shutdown the array in these lines above.

I do not see you sending the UPS the command to shut itself down.  If you do not do that, in a real power failure the server will shut down and the UPS will continue to run until its batteries are depleted. 

 

Is there a reason you are not using the normal "smart" features of the UPS and using an explicit timeout instead? 

  • Author

the last at the beginning. you are right the ups is still working. i though

it would be normal that the apc is running till its out of power?

 

??? ??? so what do you mean with the normal "smart" features of the UPS? is there any

code line i forgot?

 

and the cp line is deleted now. all the rest, does the unraid

server is shutting down the array right? i mean is the shutdown line right?

the last at the beginning. you are right the ups is still working. i though

it would be normal that the apc is running till its out of power?

 

??? ??? so what do you mean with the normal "smart" features of the UPS? is there any

code line i forgot?

 

and the cp line is deleted now. all the rest, does the unraid

server is shutting down the array right? i mean is the shutdown line right?

What model APC UPS did you purchase.

 

Almost all APC brand have the ability to monitor their own batteries and the attached load of the server, and start a shutdown when there is either a minimum amount of run-time remains, OR a minimum percentage of battery charge remains.  They can dynamically determine if a power outage is getting to where the power outage is long enough to need a power-down of the server.

 

I've got my UPS set to initiate a shutdown when 10% charge is remaining, or when 4 minutes of run-time remain... whichever comes first will start the process.

 

The TIMEOUT 0 variable you changed is usually only used when the UPS is a dumb one, unable to monitor its own batteries and load.

 

Joe L.

 

 

  • Author

can you copy a example of your configuration? or where can i find more information about shuting down the usv themself?  ??? ???

 

 

  • 5 weeks later...
actually, I have a new .conf file that is specifically for that need.

 

The information you want is in the apcupsd documentation.

 

The apcupsd package .conf file created allows you to specify when installing it if you wish the UPS shut down or not.

 

If you care to use your own scripts rather than the unMENU package manager, you can see how you need to modify (via stream edit)

the unMENU rc.d script to have it send the apsupsd killpower message to the UPS by looking at the PACKAGE_INSTALLATION lines in the .conf script.  (Those lines are used to create the install file needed each time you reboot the server)

 

#UNMENU_RELEASE $Revision: 7 $ $Date: 2010-03-29 23:12:23 -0400 (Mon, 29 Mar 2010) $
PACKAGE_NAME apcupsd - A daemon for controlling APC UPS devices
PACKAGE_DESCR Apcupsd can be used for power management and controlling most
PACKAGE_DESCR of APC's UPS models on Unix and Windows machines. <br>Apcupsd works with most of APC's
PACKAGE_DESCR Smart-UPS models as well as most simple signalling models such as Back-UPS and BackUPS-Office.
PACKAGE_DESCR
PACKAGE_DESCR <br><br>Note: If you elect to not power down the UPS, the server may not detect when power is eventually restored, and will not start until you press its power button.
PACKAGE_DESCR In addition, the UPS will run until its batteries are depleted, rather than attempt to conserve its batteries.
PACKAGE_DESCR For this reason, most users will want to set <b>Power Down UPS after shutdown?</b> = <b>YES</b> <br>
PACKAGE_DESCR If <b>Power Down UPS after shutdown?</b> = <b>NO</b>, the UPS will not power down.  You only want this if the UPS is
PACKAGE_DESCR also powering other equipment that must stay powered after the unRAID server is shut down.
PACKAGE_URL http://linuxpackages.cs.utah.edu//Slackware-12.0/ken/apcupsd-3.14.3-i486-1kjz.tgz
PACKAGE_FILE apcupsd-3.14.3-i486-1kjz.tgz
PACKAGE_INSTALLED /sbin/apcaccess
PACKAGE_DEPENDENCIES /usr/bin/mail, /sbin/powerdown
PACKAGE_MD5 98ef68509ed27848f3a8782784d42c42
PACKAGE_VARIABLE Use Serial Port?(YES/NO)||vDEVICE=NO||If set to NO, a connection via USB cable is used.  If YES, a connection via SERIAL cable will be used.
PACKAGE_VARIABLE Cable Type:(smart/usb/dumb)||vCABLETYPE=smart||Use "smart" for APC UPS, "usb" for some other brands, "dumb" for others with appropriate cable to serial port.
PACKAGE_VARIABLE Battery Level||vBATTERYLEVEL=10||Shutdown will occur when percentage charge remaining is less than this level.
PACKAGE_VARIABLE Minutes Remaining||vMINUTES=5||Shutdown will occur when remaining runtime reaches this value.
PACKAGE_VARIABLE Total Seconds Outage||vTIMEOUT=300||If outage (in seconds) exceeds this value, a shutdown will occur.
PACKAGE_VARIABLE Power Down UPS after shutdown?(YES/NO)||vUPS_KILL=YES||If YES the UPS will power itself off after the server is powered down.  This allows it to save its batteries.  If NO, the UPS will not power down.  You only want this if the UPS is powering other equipment that must stay powered.
PACKAGE_INSTALLATION test -f /etc/apcupsd/apcupsd.conf && rm /etc/apcupsd/apcupsd.conf
PACKAGE_INSTALLATION [ ! -d /var/lock/subsys/ ] && mkdir -p /var/lock/subsys
PACKAGE_INSTALLATION [ -f /etc/rc.d/rc.apcupsd ] && /etc/rc.d/rc.apcupsd stop
PACKAGE_INSTALLATION killall apcupsd
PACKAGE_INSTALLATION installpkg apcupsd-3.14.3-i486-1kjz.tgz
PACKAGE_INSTALLATION [ "${vDEVICE-NO}" != "YES" ] && sed -i -e "s/^DEVICE \/dev\/ttyS0/#DEVICE \/dev\/ttyS0/" /etc/apcupsd/apcupsd.conf
PACKAGE_INSTALLATION [ "${vDEVICE-NO}" = "YES" ] && sed -i -e "s/^UPSTYPE usb/UPSTYPE apcsmart/" /etc/apcupsd/apcupsd.conf
PACKAGE_INSTALLATION [ "${vCABLETYPE-smart}" != "smart" ] && sed -i -e "s/^UPSCABLE smart/UPSCABLE ${vCABLETYPE-smart}/" /etc/apcupsd/apcupsd.conf
PACKAGE_INSTALLATION sed -i -e "s/^MINUTES 3/MINUTES ${vMINUTES-5}/" /etc/apcupsd/apcupsd.conf
PACKAGE_INSTALLATION sed -i -e "s/^BATTERYLEVEL 5/BATTERYLEVEL ${vBATTERYLEVEL-10}/" /etc/apcupsd/apcupsd.conf
PACKAGE_INSTALLATION sed -i -e "s/^TIMEOUT 0/TIMEOUT ${vTIMEOUT-300}/" /etc/apcupsd/apcupsd.conf
PACKAGE_INSTALLATION sed -i -e "s/WALL=wall/WALL=\"mail -s 'unRAID_Server_UPS_Alert' root\"/" /etc/apcupsd/apccontrol
PACKAGE_INSTALLATION /etc/rc.d/rc.apcupsd start
PACKAGE_INSTALLATION #Now, put into place the shutdown script replacement
PACKAGE_INSTALLATION echo "/sbin/powerdown" >/etc/apcupsd/doshutdown
PACKAGE_INSTALLATION echo "exit 99" >>/etc/apcupsd/doshutdown
PACKAGE_INSTALLATION chmod 755 /etc/apcupsd/doshutdown
PACKAGE_INSTALLATION [ "${vUPS_KILL-YES}" != "NO" ] && sed -i -e "s/\/sbin\/poweroff/\/etc\/apcupsd\/apccontrol killpower; \/sbin\/poweroff/" /etc/rc.d/rc.6
PACKAGE_VERSION_TEST strings /sbin/apcupsd 2>&1 | grep VERSION | awk '{print $3}'
PACKAGE_VERSION_STRING 3.14.3
PACKAGE_MEMORY_USAGE Light (10K to 500K)

 

If you wish to install the latest unMENU application, you can download the unmenu_install program from here:

http://unraid-unmenu.googlecode.com/files/unmenu_install.zip

http://unraid-unmenu.googlecode.com/files/unmenu_install13.zip

 

Create a /boot/unmenu directory

mkdir /boot/unmenu

 

un-zip the downloaded file.  Movie it to the /boot/unmenu folder on your flash drive, then type

cd /boot/unmenu

unmenu_install -i

or to update an existing installation

copy the file to your existing unmenu folder and then type:

unmenu_install -u

 

Once installed, you need to kill and re-start unmenu to see the new version.

killall awk

will usually do it

followed by

/boot/unmenu/uu

 

 

Edit:

I was forced to make a change to the unmenu_install program.  I found it incorrectly identified package-config files you had edited as being out of date and needing to be replaced with an un-edited version.  Obviously, this would not work too well, un-doing the variables you had just configured..   This also gave me the opportunity to replace the download file name with something I can change over time as I replace new versions.

 

So far, 5 or 6 people downloaded the initial version I posted.    The current version says "Revision 20" on the top line.  If yours says "Revision 19" please download a new copy from the link above.  

 

Joe L.

Joe, I already have unMenu 1.2 in place with following modules. smarthistory is custom added and apcupsd is modified. I also added WeeboTech's powerdown with mappings from Ctrl-Alt-Del (and the soft power button) to it. Do you think that the migration would easily work without screwing something else? Here the unMenu 1.2 about info I have:

 

unmenu.awk: Version 1.2 Joe L.... with modifications as suggested by bjp999 and many others

 

Plug-in-modules

07-unmenu-mymain.awk: 1.45 - contributed by bjp999

08-unmenu-array_mgmt.awk: 1.0 - Joe L.

09-unmenu-disk_mgmt.awk: 1.2 - print reiserfsck commands for rebuild-tree (if needed) to screen. Joe L.

10-unmenu-links.awk: 1.2 Fixed increment of link counter

16-unmenu-syslog.awk: Version: .9  - modified by Joe L. to escape special charaters

17-unmenu-syslog.awk: Version: .8  - modified by Joe L. to use a pattern file.

18-unmenu-lsof.awk: Version: .1  - Joe L.

20-unmenu-usage.awk: 1.0

200-unmenu-smarthistory.cgi: (ADD_ON_VERSION not specified in plug-in, default version assigned) 0.1

25-unmenu-dupe_files.awk: 1.2 deal with appostraphe in file name

29-unmenu-sysinfo.awk: 1.3 - modified to better deal with utilities not yet installed Joe L.

30-unmenu-file_browser.awk: 1.1.4 fixed handling of directory names with embedded spaces. Joe L.

50-unmenu-user_scripts.cgi: .3 - Fixed to allow single quotes in button labels

600-unmenu-file_edit.awk: .2 Updated with ideas borrowed from go-script-manager plug-in to keep backup versions of files.

99-unmenu-utility.awk: 1.0 - contributed by bjp999

990-unmenu-wget.awk: 1.5 Improved handling of download when 404 "not-found" error returned on download URL

999-unmenu-unraid_main.awk: 1.1 Joe L. -- Added parse of "ps" to check for non-standard emhttp port.

Joe, just took the pluge and installed the new version. So far, really an improvement - big thanks!

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.