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

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.

 

Yeah, I noticed that, must be something with windows but my script doesnt have the problem, built it using vi.

  • Replies 481
  • Views 199.9k
  • 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

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.

 

Yeah, I noticed that, must be something with windows but my script doesnt have the problem, built it using vi.

vi will not add the extra linefeeds.  Glad the script is working for you. 

 

Windows tries so much to be helpful... and fails so often if the files it is editing are not plain text.

I was interested in installing an automatic S3 script without having to click the S3 button in unMenu. I would like my server to sleep 30 minutes after all drives going to sleep, only between certain hours of the day and when no network activity is detected through xbmc either on my xbox or laptop. I was able to watch a ~20 minute TV episode the other day without the drive spinning up. I'm assuming since it was the last file added to the server, cache_dirs had it all in cache without needing to access the drive where the show is stored.

 

The problem is which one to use. There seems to be at least a couple that are working, one from ReneV here: http://lime-technology.com/forum/index.php?topic=3657.msg41767#msg41767, one from kapperz here: http://lime-technology.com/forum/index.php?topic=3657.msg42253#msg42253 and another by aht961 here: http://lime-technology.com/forum/index.php?topic=3657.msg51790#msg51790. I'm leaning towards kapperz version as I seem to be able to follow it better (noob here).

 

Any help is appreciated picking the right one

Hi, I'm using ReneV:s script, this one have some xtra functions that the other don't have.

 

I did have some problem in the past when I should wake may server, but after upgrading to 4.5.3 these issue are gone now :-) So Suspending my server works great now.

 

//Peter

Hi, I'm using ReneV:s script, this one have some xtra functions that the other don't have.

 

I did have some problem in the past when I should wake may server, but after upgrading to 4.5.3 these issue are gone now :-) So Suspending my server works great now.

 

//Peter

 

Thanks Peter,

 

I got it working...I think ;)

 

Will see tonight after 11pm if it goes to sleep

 

well it's working... ;D

 

just a bit off topic relating to power failures http://lime-technology.com/forum/index.php?topic=6248.0

 

What happens if the power goes out while the server is asleep? Will it go through a parity check on startup?

It all depends on the UPS.  If it has enough capacity to keep the server powered (and asleep) through the outage, then no parity check will occur, since the server really never knew the power dropped.

 

If the initial power-loss signal from the UPS wakes the server up (and I have NO idea if it will wake on USB activity) then I'd guess it might be able to shut the server down.    Only some tests would let you know.  It is why you perform a "sync" before putting the server to sleep.  Hopefully, it will get everything written to  the disks that needs writing.

 

Joe L.

Joe,

 

There are a few different versions in this thread, so I went with ReneV's. I'm not sure if the script syncs the drives. Attached is the file I'm using. If you have a chance to look through it, please let me know if I should change/add anything.

 

thanks

 

EDIT: looking through other files, should i add the following: /bin/sync

 

as in

 

 

                                # Do pre-sleep activities

                                        pre_sleep_activity

                                        sleep 5

                                        /bin/sync

                                # Go to sleep

                                        echo 3 > /proc/acpi/sleep

auto_s3_sleep.sh.txt

Just getting back to look into this.  When I issue echo 3 > /proc/acpi/sleep  nothing happens.  I will check everything but first a little question.  If I look at /bin/acpi/sleep (cat /proc/acpi/sleep) all I see is a single line that looks like S0 S3 S5.  That looks strange to me as I would have expected to see a bunch of gibberish being the code of a program. Is it correct?  Or did it somehow get destroyed?

Just getting back to look into this.  When I issue echo 3 > /proc/acpi/sleep  nothing happens.  I will check everything but first a little question.  If I look at /bin/acpi/sleep (cat /proc/acpi/sleep) all I see is a single line that looks like S0 S3 S5.  That looks strange to me as I would have expected to see a bunch of gibberish being the code of a program. Is it correct?  Or did it somehow get destroyed?

It is correct.

The /proc file-system entries are not programs, but a interface to part of the Linux kernel.  Think of it as a two way bi-directional port.  You can write to it, you can read from it, and a part of the Linux kernel is listening/responding from the other end.

 

/proc/acpi/sleep is supposed to indicate the modes your BIOS indicated it could handle. 

You might also have to set in your BIOS what it should do when it gets an S3 Sleep request.  Some ignore it by default.

 

An FYI, the /proc/acpi/sleep is being replaced by /sys/power/state in newer Linux kernels. 

See here: http://acpi.sourceforge.net/documentation/sleep.html

Thanks Joe.  Now I have to figure out whay it is not working.  When I was first building the unRaid I tested it and it worked but had poblems on waking up.  It did not restore the Monitor correctly so I decided to put off the use of that feature completely. I am now looking at it again.

 

I will have to check it all from scratch.  I am assuming that if the array is stopped before I try the S3 suspend, that should be enough to keep unraid happy.

I will have to check it all from scratch.  I am assuming that if the array is stopped before I try the S3 suspend, that should be enough to keep unraid happy.

yes, even if you have to power cycle or hit reset it will still be happy if it was stopped first.

Once you figure out the S3 stuff, you should be able to do it without stopping the array first.

  • 3 weeks later...

Anyone know how to automate wakeup after the unRAID box has been put to sleep? I want it to wake up automatically as soon as a computer access it, like with Apple computers? Any comments on this?

Anyone know how to automate wakeup after the unRAID box has been put to sleep? I want it to wake up automatically as soon as a computer access it, like with Apple computers? Any comments on this?

That is called Wake-On-Lan.  You send it a special packet from the apple computer.  The network card in the unRAID server will recognize its MAC address and wake the server. Even though the server goes to sleep, it stays powered up.  (you'll need to enable Wake-On-Lan in your unRAID MB BIOS too.)

 

Joe L.

I know the WOL with Magic Packet, I was thinking about waking up on connection to the IP address of unRAID. WOL with Magic Packet works flawless, the thing is, I don't have a way to send it automatically when a client access a share on unRAID. I have tried setting "p" with ethtool on WOL for eth0 but then unRAID wakes up on every network activity. I can WOL from a script by sending the Magic Packet but I am looking to automate things. In the Apple world, accessing a share on another computer wakes up the other box (if it is setup to be waken up of course). I am looking for such functionality.

 

Accessing a share should automatically wake up unRAID. Any ideas?

I know the WOL with Magic Packet, I was thinking about waking up on connection to the IP address of unRAID. WOL with Magic Packet works flawless, the thing is, I don't have a way to send it automatically when a client access a share on unRAID. I have tried setting "p" with ethtool on WOL for eth0 but then unRAID wakes up on every network activity. I can WOL from a script by sending the Magic Packet but I am looking to automate things. In the Apple world, accessing a share on another computer wakes up the other box (if it is setup to be waken up of course). I am looking for such functionality.

 

Accessing a share should automatically wake up unRAID. Any ideas?

That feature is dependent on your network controller firmware.  You are looking for "wake on ARP"

 

You can see what your network card supports by typing

ethtool eth0

 

My server looks like this:

ethtool eth0

Settings for eth0:

        Supported ports: [ TP ]

        Supported link modes:  10baseT/Half 10baseT/Full

                                100baseT/Half 100baseT/Full

                                1000baseT/Full

        Supports auto-negotiation: Yes

        Advertised link modes:  10baseT/Half 10baseT/Full

                                100baseT/Half 100baseT/Full

                                1000baseT/Full

        Advertised auto-negotiation: Yes

        Speed: 1000Mb/s

        Duplex: Full

        Port: Twisted Pair

        PHYAD: 0

        Transceiver: internal

        Auto-negotiation: on

        Supports Wake-on: umbg

        Wake-on: g

        Current message level: 0x00000007 (7)

        Link detected: yes

 

It cannot be awakened by an ARP request... the network card just does not support it.

 

You are looking for a network card that

Supports Wake-on: a  <- ARP request.

 

 

 

Anyone have a list of NICs that support wake on ARP with Unraid?  I desperately want this functionality.  I thought wake on unicast was what I needed but that doesn't work.

Joe, thanks. Will try it out. My NICs support full pumbag.

 

Edit: I've just set eth0 to Wake-on: ag, put to sleep and tried waking the unRAID box by accessing a share on it. It did not work. Waked up by sending a Magic Paket, no problem. Any more hints I may try out?

You are looking for a network card that

Supports Wake-on: a  <- ARP request.

 

This doesn't wake unRAID. I have Intel NICs on my Supermicro boards (X7SBE and X7SPA-HF), that supports all pumbag. Setting to ag doesn't change behaviour. unRAID won't wake up by accessing a share on it. This is dubious!!

 

Anything else to check on the mainboard or BIOS?

  • 2 weeks later...

Any other hints on this? Anyone has waken up unRAID by setting Wake-on of its interface to "a" and by sending an ARP request?

Any other hints on this? Anyone has waken up unRAID by setting Wake-on of its interface to "a" and by sending an ARP request?

 

...just curious...what is the reading of your /proc/acpi/wakeup ?

Mine on a X7SPA-HF is:

root@unRaid1:~# cat /proc/acpi/wakeup

Device  S-state  Status  Sysfs node

P0P1      S4    disabled  pci:0000:00:1e.0

USB0      S4    disabled  pci:0000:00:1d.0

USB1      S4    disabled  pci:0000:00:1d.1

USB2      S4    disabled  pci:0000:00:1d.2

USB5      S4    disabled

EUSB      S4    disabled  pci:0000:00:1d.7

USB3      S4    disabled  pci:0000:00:1a.0

USB4      S4    disabled  pci:0000:00:1a.1

USB6      S4    disabled  pci:0000:00:1a.2

USBE      S4    disabled  pci:0000:00:1a.7

P0P4      S4    disabled  pci:0000:00:1c.0

P0P5      S4    disabled

P0P6      S4    disabled

P0P7      S4    disabled

P0P8      S4    disabled  pci:0000:00:1c.4

P0P9      S4    disabled  pci:0000:00:1c.5

GBE      S4    disabled

root@unRaid1:~# lspci | grep -i eth

02:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection

03:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection

root@unRaid1:~#

 

All my devices listed are currently disabled.

...what makes me nervous is, that the ETH0 and ETH1 devices, which reside on PCI-02:00 and PCI-03:00

according to "lspci", are not listed in the acpi wakeup list.

Since you reported that "g" mode is working OK, I am wondering if you have the ethx showing up?

 

TIA!

regards,

            Ford

 

 

If anyone gets wake-on-ARP working, would you please post your config?  This is basically the only feature that I still need out of my Unraid and I'm willing to replace my hardware to get it.

 

If anyone gets wake-on-ARP working, would you please post your config?  This is basically the only feature that I still need out of my Unraid and I'm willing to replace my hardware to get it.

 

Look here: http://lime-technology.com/forum/index.php?topic=6729

  • 1 month later...

EDIT: looking through other files, should i add the following: /bin/sync

 

as in

 

 

                                # Do pre-sleep activities

                                        pre_sleep_activity

                                        sleep 5

                                        /bin/sync

                                # Go to sleep

                                        echo 3 > /proc/acpi/sleep

 

 

I would also like to know this. Do we need to add /bin/sync to the pre_sleep_activity() ?

OK guys, I went ahead and edited the script with echoed output for info etc. This is what the output looks like

 

Thu Aug 5 15:01:41 BOT 2010 Starting S3 script
Thu Aug 5 15:16:47 BOT 2010 Mover Complete
Thu Aug 5 15:17:06 BOT 2010 Sync Complete
Thu Aug 5 15:17:11 BOT 2010 Going to sleep NOW!
Thu Aug 5 15:17:11 BOT 2010 unRAID Server Offline
Switching from vt1 to vt1
Calling get_mode
Calling do_post
Calling set_vbe_mode
switching back to vt1
Thu Aug 5 15:18:26 BOT 2010 Resumed from sleep
Thu Aug 5 15:18:26 BOT 2010 Network set to Gb
Thu Aug 5 15:18:26 BOT 2010 unRAID Server Online

 

Its the same script as posted before by numerous guys

 

  • Sleep timer configurable
  • Sleep only during XX hours configurable
  • Checks for no HDD activity
  • Checks for no Network activity
  • Checks to see if another dependent host is alive before sleeping
  • Moves all files from cache before shutting down
  • Syncs disks before shutting down
  • Uses s2ram for shutdown
  • Renews DHCP on awake
  • Resets Gb Ethernet on awake

 

Thanks again for all that made this script happen. I have attached it below for redundancy.

s3.zip

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.