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


Recommended Posts

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.

Link to comment

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.

Link to comment

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

Link to comment

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

Link to comment

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

 

Link to comment

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.

Link to comment

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

Link to comment

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?

Link to comment

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

Link to comment

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.

Link to comment

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.

Link to comment
  • 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?

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.

Link to comment

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?

Link to comment

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.

 

 

 

Link to comment

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?

Link to comment

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?

Link to comment
  • 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?

 

...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

 

 

Link to comment
  • 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() ?

Link to comment

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

Link to comment

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.