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.

Scripting A Graceful Power Down - Modify Sleep Script?

Featured Replies

I'm running 5.0-rc5.  I'd like to have my unRAID box power down when there is no activity (and perhaps when it can no longer ping my frontend HTPC).  I've been using the attached sleep script to put my server in sleep mode.  Is it feasible to modify this script and invoke a "clean" shutdown instead of invoking the sleep command (echo 3 > /proc/acpi/sleep)?

 

I saw the sticky topic regarding getting the power button to cleaning shut down an unRAID server:

 

http://lime-technology.com/forum/index.php?topic=6078.0

 

So I think I have a better understanding of all that needs to happen for a clean shutdown.  I'm aware of the powerdown script here:

 

http://lime-technology.com/wiki/index.php/Powerdown_script

 

My first question is does anyone know if that script works with 5.0-rc5?  Can I leverage that script or portions of it with attached sleep script to call shutdown?  I know vbscript in the Windows world but I'm at a loss as far as any kind of Linux scripting.  Does anyone have any suggestions, tips, code, whatever for me?  :)  Any help would be greatly appreciated.

s3.txt

That script is included in the APCupsd plugin. You can get an idea how it is called from within that plugin.

 

Sent from my SAMSUNG-SGH-I897 using Tapatalk 2

  • Author

That script is included in the APCupsd plugin. You can get an idea how it is called from within that plugin.

 

Sent from my SAMSUNG-SGH-I897 using Tapatalk 2

 

Thank you for the suggestion.  I was way over-thinking this.  I simply downloaded the powerdown script from http://lime-technology.com/wiki/index.php/Powerdown_script, added the install line to my go script and replaced the

echo 3 > /proc/acpi/sleep

line with

/sbin/powerdown

.  Seems to be working exactly like I want.

  • 6 months later...

I am looking at  doing something similar.  How did you set this up?

  • 2 weeks later...
  • Author

I am looking at  doing something similar.  How did you set this up?

 

There's not much to it.  Download the powerdown script from here:

 

http://code.google.com/p/unraid-powercontrol/downloads/list

 

Copy that file to your flash drive (packages directory).

 

Download the attached s3.txt file and rename it to s3.sh.  Copy that file to your flash drive (custom\bin directory - create those if they are not there).  You'll need to edit line 22 to suite your needs (the IP(s) you want to ping to keep your unRAID box from shutting down when they're on - or leave it blank if you don't want to use the ping test):

 

pingIPs="192.168.1.150" # do not sleep if <$pingsIPs> are pingable

 

The s3 script checks to see if the HDDs in your array are spun down.  I believe this happens before it tries the ping test.  Therefore, the amount of time that will elapse from the time you power down your front end boxes and your unRAID box powers down will depend on you HDD spin down settings.

 

Add the following lines to your go script (in the config directory):

 

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

cd /boot/custom/bin
nohup ./s3.sh &

 

Reboot your unRAID box and you should be in business.  Hope that helps.

 

***********************************************************

***********************************************************

 

So it is clear, the s3 script was not written by me.  I found it in this thread:

 

http://lime-technology.com/forum/index.php?topic=3657.0

 

Unfortunately I don't recall which version of the script I took but all credit for the script goes to the folks in that forum.  I simply changed one line (148) which is described in my previous post.

 

Thank you for the suggestion.  I was way over-thinking this.  I simply downloaded the powerdown script from http://lime-technology.com/wiki/index.php/Powerdown_script, added the install line to my go script and replaced the

 

echo 3 > /proc/acpi/sleep

 

line with

 

/sbin/powerdown

 

Seems to be working exactly like I want.

s3.txt

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.