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.

Looking for better ideas how how to sleep/suspend my unraid box

Featured Replies

Referring to the s3.sh script here: http://lime-technology.com/forum/index.php?topic=3657.msg51790#msg51790, is there any way to add a line to the script which prevents the server going to S3 if there is a client-server connection using the http interface (like browsing the main page of UNRAID or UNMENU)?

 

My problem is, I have added the other clients' IPs to the s3.sh script and it works like a charm. However, the client which I use for logging to the server's UNMENU's main page is a Os X running Snow Leopard which sleeps one eye open (even in sleep its IP is broadcasted to the LAN). Therfore I do not want to add its IP to the s3.sh, otherwise the UNRAID will never sleep either :( Any suggestions? At the moment the UNRAID is going to S3 state as intended since the HDDs are not spinning but not convenient in the middle of a http session.

  • Replies 481
  • Views 199.7k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • I put my notes on getting sleep and wake on lan working in the wiki under the 'How-Tos' section.  This way the smart people can go in and make edits and hopefully make it more useful.    Link: htt

  • ok i seem to found out the reason and a solution the reason for the sleep/wake/sleep is the conflict between acpi handler script and the elogind configuration. they both react to the key press an

Posted Images

This seems interesting, so you just download the file, copy it into a location, evoke the install in the go script and replace the 'echo 3 >/proc/acpi/sleep' with this utility? What is the differences from using the s3.sh to this utility and how would you set it up to run once all HDD's go to sleep? Thanks.

 

 

 

Replace echo 3 >/proc/acpi/sleep with this pm-suspend

 

I've been using the 's3.sh' script for a few days and it is fine, the server sleeps in about 10 seconds and wakes up, to be up and ready no longer than 10 seconds. My question is (might be a an obvious answer), though I can't hear my PSU running, and giving it still needs to keep RAM powered to hold it's contents, will this draw large amounts of power to do this? Also, If I disconnect the power cord or switch off the PSU for longer then a few seconds, the suspended state will no longer be valid?

I've been using the 's3.sh' script for a few days and it is fine, the server sleeps in about 10 seconds and wakes up, to be up and ready no longer than 10 seconds. My question is (might be a an obvious answer), though I can't hear my PSU running, and giving it still needs to keep RAM powered to hold it's contents, will this draw large amounts of power to do this? Also, If I disconnect the power cord or switch off the PSU for longer then a few seconds, the suspended state will no longer be valid?

My server takes approx 2,5 Watts when in S3, so yes, RAM refresh is required but doesn't need very much.

If you loose power, you cannot resume as you stated, it's like disconnecting while the system is running. you should use a UPS anyway ...

Might be worth to call a "sync" before going to S3 - I have never done this so far.

The 's3.sh' script that I was using integrated the 'sync' command into it, so it would sync all disks and place the server to sleep. I've now reverted back to using the 'powerdown' command as I've resolved the WOL from a powered off state, not sleep/suspend. I had to roll back to 4.5.1, as it stopped working after the 4.5.3 update. Strange, but it is good to know the wattage it consumes when in sleep mode. Thanks.

  • 3 weeks later...

Can someone who understands all the changes and modifications please update the wiki accordingly? Maybe also add info about using bwm-ng and pm-utils and why one would need them. It has been awhile since I played around with s3 and unraid. When I came back to this thread I was overwhelmed at all the changes and additions to the original s3.sh script  ???. I was wanting to reset mine up from scratch but now I am somewhat confused on what script would be best to use and what the bwm-ng package and pm-utils package do.

  • 4 weeks later...

Sorry for re-posting. I sorted it out - the problem is solved. For some reason, I have edited the shell script using the text editor (for Os X), the script file was corrupted. I had to rewrite it with another application which could save it as a unix file. Then it started to function as it was meant to. Apologies for taking your time. Probably it could have worked at the first place if I executed it using "fromdos" command. I do not know. Nevertheless, the server goes to S3 and wakes-on-lan. Thank you for your time.

 

Hi there,

 

I'm having the same problem as you, nohup s3.sh and it says there's no such file/directory.

 

I didn't edit the script, I just moved it into the custom/bin directory, renamed it s3.sh, chmod-ed it. But somehow it doesn't work. What am I missing?

Sorry for re-posting. I sorted it out - the problem is solved. For some reason, I have edited the shell script using the text editor (for Os X), the script file was corrupted. I had to rewrite it with another application which could save it as a unix file. Then it started to function as it was meant to. Apologies for taking your time. Probably it could have worked at the first place if I executed it using "fromdos" command. I do not know. Nevertheless, the server goes to S3 and wakes-on-lan. Thank you for your time.

 

Hi there,

 

I'm having the same problem as you, nohup s3.sh and it says there's no such file/directory.

 

I didn't edit the script, I just moved it into the custom/bin directory, renamed it s3.sh, chmod-ed it. But somehow it doesn't work. What am I missing?

It is probably not in your search PATH.

 

Try giving it a full path

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

 

or a "change directory" and give a relative path of ./s3.sh"

 

cd /boot/custom/bin

nohup ./s3.sh &

It is probably not in your search PATH.

 

Try giving it a full path

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

 

or a "change directory" and give a relative path of ./s3.sh"

 

cd /boot/custom/bin

nohup ./s3.sh &

 

Nope, I did exactly that, both ways, doesn't work.

 

I've attached a screen shot of the telnet session, I also checked to make sure there's a file named s3.sh in the directory...

 

Any idea what else it could be?

s3problem.jpg.58d5cc21417b84a59199b73ce8bc6fa2.jpg

Hi again Joe,

 

Thanks again for the help.

 

I didn't edit the file at all, just downloaded, changed .txt to .sh, copied over to the flash drive. But just to be sure, I used Notepad2 to save it and made sure the line endings were Unix and there seems to be some difference.

 

Now when I do "nohup ./s3.sh &", I get the following instead:

[3] 5626

root@ELhub:/boot/custom/bin# nohup: ignoring input and appending outpot to 'nohup.out'

 

Is that what's supposed to happen?

 

ls -l gives me the following:

 

-rwxrwxrwx 1 root root 4163 ....... ./s3.sh

Hi again Joe,

 

Thanks again for the help.

 

I didn't edit the file at all, just downloaded, changed .txt to .sh, copied over to the flash drive. But just to be sure, I used Notepad2 to save it and made sure the line endings were Unix and there seems to be some difference.

 

Now when I do "nohup ./s3.sh &", I get the following instead:

[3] 5626

root@ELhub:/boot/custom/bin# nohup: ignoring input and appending outpot to 'nohup.out'

 

Is that what's supposed to happen?

 

ls -l gives me the following:

 

-rwxrwxrwx 1 root root 4163 ....... ./s3.sh

It sounds like your line-endings were wrong and by using notepad2 you fixed them.

 

Type

cat nohup.out

to see the output of the s3.sh command.  (there may not be anything)

 

What you are now seeing now looks normal.

 

Joe L.

It sounds like your line-endings were wrong and by using notepad2 you fixed them.

 

Type

cat nohup.out

to see the output of the s3.sh command.   (there may not be anything)

 

What you are now seeing now looks normal.

 

Joe L.

 

Thanks Joe, cat nohup.out shows nothing.

 

So it's working?

It sounds like your line-endings were wrong and by using notepad2 you fixed them.

 

Type

cat nohup.out

to see the output of the s3.sh command.   (there may not be anything)

 

What you are now seeing now looks normal.

 

Joe L.

I have no idea... my motherboard does not do S3.  If yours does, and if the script does what you need, and it has not exited, it might work.

 

The fact that the nohup.out file is blank simply means there was nothing output from the command as error message or "echo" statements.

 

Joe L.

Thanks Joe, cat nohup.out shows nothing.

 

So it's working?

I have no idea... my motherboard does not do S3.   If yours does, and if the script does what you need, and it has not exited, it might work.

 

The fact that the nohup.out file is blank simply means there was nothing output from the command as error message or "echo" statements.

 

Joe L.

 

Once again, thanks a lot Joe! The array went to sleep automatically and can now be woken up via WOL! Awesome!

 

Thanks again!

Can anyone get their Unraid to wake on a unicast packet instead of a magic packet?  All of my servers have an E1000 NIC in them and I can't get unicast to work at all.  Magic packet works like a champ, but it's not practical to issue magic packets to wake these things due to the usage patterns.

 

I'd be very interested to know if anyone can get unicast working with an E1000 NIC, or if you have a motherboard that does work I'd like to know what NIC is in it and what the model number of the motherboard is.  I recently did a calculation of how much these servers are costing me in electricity while idling, and it's become clear that I need to get S3 working.

Ok, forgive me if this seems elementary but new to scripting. So I've got my server working with S3 sleep and all my xbmc boxes are now configured to wake the server when they come out of sleep. I've testing sleep using the sleep script in unmenu.

 

So what I'd like to do is configure my unraid box to go to sleep after say about 2 hours of inactivity. Do I have to put the script in one of the cron folders?

 

Also, how do I configure things so the box doesnt sleep when doing things like a parity check or when something is streaming from it or I'm writing to it? Just trying to automate all this and this should be the last step.

Also, how do I configure things so the box doesnt sleep when doing things like a parity check or when something is streaming from it or I'm writing to it? Just trying to automate all this and this should be the last step.

The latest script in this thread takes care of that for you I believe. It has settings to not let the server sleep if there is network access or the discs are not spun down. Download the script and open it up to look at it. The settings are all in the first part of the script.

Also, how do I configure things so the box doesnt sleep when doing things like a parity check or when something is streaming from it or I'm writing to it? Just trying to automate all this and this should be the last step.

 

speaking of parity check. Using unMenu, will the monthly parity check (tonight 00am), not run if the server is asleep? Or will it run once the server comes back on? I put the server to sleep by clicking the S3 script button in unMenu.

Also, how do I configure things so the box doesnt sleep when doing things like a parity check or when something is streaming from it or I'm writing to it? Just trying to automate all this and this should be the last step.

 

speaking of parity check. Using unMenu, will the monthly parity check (tonight 00am), not run if the server is asleep? Or will it run once the server comes back on? I put the server to sleep by clicking the S3 script button in unMenu.

It will not run because cron will not invoke it because it will not be running.

 

cron does not go back to run items that were scheduled when it was sleeping.  So basically, the monthly check will not run at all.

 

Joe L.

 

Also, how do I configure things so the box doesnt sleep when doing things like a parity check or when something is streaming from it or I'm writing to it? Just trying to automate all this and this should be the last step.

 

speaking of parity check. Using unMenu, will the monthly parity check (tonight 00am), not run if the server is asleep? Or will it run once the server comes back on? I put the server to sleep by clicking the S3 script button in unMenu.

It will not run because cron will not invoke it because it will not be running.

 

cron does not go back to run items that were scheduled when it was sleeping.  So basically, the monthly check will not run at all.

 

Joe L.

 

 

thanks Joe,

 

I guess I'll make sure the server is on tonight before going to bed...

Also, how do I configure things so the box doesnt sleep when doing things like a parity check or when something is streaming from it or I'm writing to it? Just trying to automate all this and this should be the last step.

 

speaking of parity check. Using unMenu, will the monthly parity check (tonight 00am), not run if the server is asleep? Or will it run once the server comes back on? I put the server to sleep by clicking the S3 script button in unMenu.

It will not run because cron will not invoke it because it will not be running.

 

cron does not go back to run items that were scheduled when it was sleeping.  So basically, the monthly check will not run at all.

 

Joe L.

 

 

thanks Joe,

 

I guess I'll make sure the server is on tonight before going to bed...

Sounds like a plan...

 

Worst case, you can press the "Verify Parity" button on the unMENU Array management page in the AM if you forget.

 

Joe L.

May 1 05:26:50 Tower kernel: md: sync done. time=19608sec rate=74721K/sec

May 1 05:26:50 Tower kernel: md: recovery thread sync completion status: 0

^

that's what I like to see

 

I think I'm going to setup a Scheduled Task on my windows machine to run the Wake Up batch file on the last day of the month at 11:55pm. That way the server is awake for the scheduled monthly parity check

 

BTW, Joe awesome job with unMenu. Gives a noob like me, the power to customize unRaid easily.

I try to summarize here the steps for the beginners like me who would like to implement the sleep 3 state at their server including the very last modifications:

 

1. First check that your server is able to go to S3 and wake up via WOL according to this guideline:

http://lime-technology.com/wiki/index.php?title=Setup_Sleep_(S3)_and_Wake_on_Lan_(WOL) or you could do this via unMENU (http://lime-technology.com/forum/index.php?topic=5568.msg51814#msg51814) if you have already installed it.

 

2. Then download "bwm-ng-0.6-i486-2bj.tgz" package according to Joe's clear guidelines:

http://lime-technology.com/forum/index.php?topic=3657.msg41705#msg41705 or in a more convenient way using the unMENU add-on.

 

3. Then download the following script (s3.txt) by ReneV with the most recent modifications mentioned above (I have just added the changes mentioned in this thread after the script was uploaded - in addition for the sake of brevity I changed the name to s3.sh).

The modifications include:

- code correction ("$pingIPs" => $pingIPs)

- activated the TCP checking (default = no, here it is changed to yes => checkTCP=$yes)

- checks if the cache drive has data, moves that data to the data disks before going to sleep (added => /usr/local/sbin/mover)

If you want to configure the script, open it and change the IPs of your media players or client computers - I have added mine 192.168.0.10 and 192.168.0.100 here - if you don't want to add remove them from the appropriate line and leave it as <pingIPs="">. You don't need anything else.

 

4. After you have made your changes, save the attached s3.txt as s3.sh!

 

5. Upload the "s3.sh" script to your FLASH disk and save it e.g. /boot/custom/bin. (Create a directory at the root of your FLASH drive and call it custom/bin. So, the "custom" folder should be at the same level as your "bzimage" and "bzroot". Drop the s3.sh script within /custom/bin folder, so the final path should be "boot/custom/bin/s3.sh"). I have changed the location to /boot/custom/bin since it is the suggested path for user scripts and these scripts can be modified via unMENU!

 

6. REMEMBER to CHMOD your script! Go to the directory where your script is and type "chmod +x s3.sh" at the console.

 

7. Now, we need to INSTALL the bwm-ng package after reboot as well as to run the s3.sh script. For this, you need to get hold of your "go" file under /boot/config directory and add 3 lines to the very END of your "go" file like I did:

 

installpkg /boot/packages/bwm-ng-0.6-i486-2bj.tgz

cd /boot/custom/bin

nohup ./s3.sh &

 

The 1. line will install the bwm-ng package that you already have  (=> /boot/packages/)

The 2. line will change the directory to the folder where you have your script (=> /boot/custom/bin)

The 3. line will run the script at the background.

 

8. Now go to your server stop your array and reboot your server. Everything should be fine.

Hope that I did not miss anything :)

 

Added: Check also this if you don't want to do much hand work.

 

OK, used this post to get things setup, made one change, I replaced "/usr/local/sbin/mover" with "/bin/sync" since i don't have a cache drive and this way the discs sync before sleeping.

 

So, if I understand this correctly, with my script config, if none of my 4 media clients are on and all the hard drives are spun down (I have my drives set to spin down after 1 hour), my unraid box will go to sleep. Do I have the correct logic?

 

 

s3.txt

there are at least two places where the attached s3.txt file has had the text wrap onto a second line.  Those should be on a single line.

 

You should not use an editor that adds carriage returns or splits  long lines adding newlines.

 

Your script will probably fail if it has the same added newlines.

 

Joe L.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

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.