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


Recommended Posts

There is a logic flaw with the program.  (and you are correct, the two tests had nothing to do with each other)

 

The program will NOT properly detect a on-line device with a "ping" command if there is more than one device in the list.

 

Here is an experiment illustrating the issue, all typed on the command line:

pingIPs="192.168.2.21 192.168.2.31"

for i in "$pingIPs"; do echo ping -c1 $i; done

ping -c1 192.168.2.21 192.168.2.31

 

Notice I simply printed what would be occurring.  Notice only one "ping" command was executed, and with the argument of both IP addresses.  (It would fail as bad syntax)

 

The error is occurring because the "for" loop is being invoked incorrectly.  It should not have quote marks around $pingIPs.

 

Here is a second try with the correct syntax. Notice no quote marks around $pingIPs:

for i in $pingIPs; do echo ping -c1 $i; done

ping -c1 192.168.2.21

ping -c1 192.168.2.31

 

The fix is simple, change the for loop in the check_IP_status function from:

for i in "$pingIPs"

to

for i in $pingIPs

deleting the quote marks.

 

The program would work perfectly if you only had one IP address in the $pingIPs variable even with the quotes, but fail if you had more than one device defined.

 

Joe L.

Link to comment

Good catch Joe. I don't rely on the ping check, myself, but I do recall now that when I tried it early on it didn't work, and I had two IPs entered.

 

If you can spare some time please keep looking. Maybe there is something else simple like that has been causing my intermittent unintended sleep while playing music.

Link to comment

ReneV / lewcass - apologies but Im a bit of a linux novice' when you say... 'Windows to *nix format'....what do you mean?

 

And please could you elaborate on..... "had a LF terminating the "done" at the end of the script. Also the version that I uploaded on 01/18/10 not only had that extra LF, but also CR after every line."

 

I'm far from the best person to answer this, that's why I was looking for an article in the wiki on scripting issues that I thought I remembered reading before answering. But I couldn't find it

 

It's here:

http://lime-technology.com/wiki/index.php?title=FAQ#Why_do_my_scripts_have_problems_with_end-of-lines.3F

 

 

Link to comment

[...] Do they work as the WD Green drives using the jumper?

 

How to you do that? My WD-Greens spin up when server wakes up via WOL and after "reinitilization" - some seconds later - spin down again. Can you point me to some info regarding those jumpers to avoid spinup after WOL? I thought this is required for reinitialization of the drive. And I also have several resets after WOL to reinitialize the interfaces, e.g.:

 

Feb 11 22:18:28 XMS-GMI-01 kernel: ata3.00: SATA link up 3.0 Gbps (SStatus 123 SControl 320)

Feb 11 22:18:28 XMS-GMI-01 kernel: ata3.00: failed to IDENTIFY (I/O error, err_mask=0x11)

Feb 11 22:18:28 XMS-GMI-01 kernel: ata3.00: revalidation failed (errno=-5)

Feb 11 22:18:28 XMS-GMI-01 kernel: ata3.15: hard resetting link

Feb 11 22:18:28 XMS-GMI-01 kernel: ata3: controller in dubious state, performing PORT_RST

 

Thnaks, Guzzi

Link to comment

Hmmm, I remember theat I have read this post in the past - but didn't try because of the warnings. Currently have no testsystem to give it a try on not in use environment ...

Googling showed up posts that people were not able to set back drive to original state (WD-drives, as I do have them).

So before giving this a try I would be interested in experiences of other user and better understanding of what it means.

- hdparm -s sets the POIS mode of the drive

- On cold startup this causes a very long delay (approx 15 sec per drive = 300 secs for 20 drives = 5 mins !?

- It seems, 3132 is supporting this - no info found if also drives via portmultiplier word (i assume yes) ; found no infos about drives connected to SB700 southbridge as well

- On WOL (wake-up from S3 mode) the consequence would be, that the drive would NOT spin up (and immediately fall asleep), but just switched online controllerwise without spinning - right?

- If the drive is accessed by UnRaid, the drive will spinup as usual

 

Can anyone confirm or correct me - and also feedback to user experiences are welcome.

 

Link to comment
  • 2 weeks later...

Hi all,

 

Great thread. I have adjusted script:

#!/bin/bash

#http://lime-technology.com/wiki/index.php?title=Setup_Sleep_(S3)_and_Wake_on_Lan_(WOL)

drives="/dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf"
timeout=5
count=5

while [ 1 ]
do
  hdparm -C $drives | grep -q active
  if [ $? -eq 1 ]
  then
    count=$[$count-1]
  else
    count=$timeout
  fi
  if [ $count -le 0 ]
  then
    # Do pre-sleep activities
    sleep 5

    # Go to sleep
    /bin/sync
    /boot/config/beep-down
    echo 3 > /proc/acpi/sleep

    # Do post-sleep activities
    ethtool -s eth0 speed 1000
    ethtool -s eth0 wol gp

    # Force a DHCP renewal (shouldn't be used for static-ip boxes)
    #/sbin/dhcpcd -n
    /boot/config/beep-up

    sleep 5

    count=$timeout
  fi
  # Wait a minute
  echo COUNT $count
  sleep 60
done

 

But after wakeup from S3 the monitor on server (console) is disabled. Monitor stay in suspend mode.

How is command for enable console on server?

Link to comment

But after wakeup from S3 the monitor on server (console) is disabled. Monitor stay in suspend mode.

How is command for enable console on server?

 

If your BIOS has a setting similar to "Repost Video on S3 Resume", try setting it to Yes.

 

Another possible solution is to use the program s2ramSee earlier discussion here.

 

I do not any similiar choice as "...Video on S3 Resume" in BIOS.

 

I am try press any key on keyboard server after wakeup from S3 state. Monitor stay in suspend mode.

Server working fine but monitor connected to server not wakeup.

Link to comment

But after wakeup from S3 the monitor on server (console) is disabled. Monitor stay in suspend mode.

How is command for enable console on server?

 

If your BIOS has a setting similar to "Repost Video on S3 Resume", try setting it to Yes.

 

Another possible solution is to use the program s2ram.  See earlier discussion here.

 

I do not any similiar choice as "...Video on S3 Resume" in BIOS.

 

I am try press any key on keyboard server after wakeup from S3 state. Monitor stay in suspend mode.

Server working fine but monitor connected to server not wakeup.

 

Then, as I wrote above, you may be able to get it to work using s2ram.

 

You'll also need the libx86 package. Forum member kricker has helpfully provided this along with s2ram. See this post in the discussion thread I linked for you above.

 

If you need further help it would probably be better to continue your questions under that thread.

Link to comment

Hi all,

 

I am trying to get s3_notHrHdTcpIp to work from the go script, but I keep getting an error and it does not run.  The error is:

 

Feb 21 16:49:00 Tower atd[2174]: Exec failed for mail command: No such file or directory

 

If I copy what I have in my go script a line at a time into a telnet session it works fine.  These are the lines I added to my go script.  Funny thing is I have no mail packages installed.

 

cd /boot/custom/Server_Scripts

chmod +x s3_notHrHdTcpIp.sh

echo "s3_notHrHdTcpIp.sh" | at now + 1 minute

Link to comment

Hi all,

 

I am trying to get s3_notHrHdTcpIp to work from the go script, but I keep getting an error and it does not run.  The error is:

 

Feb 21 16:49:00 Tower atd[2174]: Exec failed for mail command: No such file or directory

 

If I copy what I have in my go script a line at a time into a telnet session it works fine.  These are the lines I added to my go script.  Funny thing is I have no mail packages installed.

 

cd /boot/custom/Server_Scripts

chmod +x s3_notHrHdTcpIp.sh

echo "s3_notHrHdTcpIp.sh" | at now + 1 minute

You can ignore the error, unRAID has no mail command , therefore "at" cannot mail to you the fact the command was started.
Link to comment

But after wakeup from S3 the monitor on server (console) is disabled. Monitor stay in suspend mode.

How is command for enable console on server?

 

If your BIOS has a setting similar to "Repost Video on S3 Resume", try setting it to Yes.

 

Another possible solution is to use the program s2ram.  See earlier discussion here.

 

I do not any similiar choice as "...Video on S3 Resume" in BIOS.

 

I am try press any key on keyboard server after wakeup from S3 state. Monitor stay in suspend mode.

Server working fine but monitor connected to server not wakeup.

 

Then, as I wrote above, you may be able to get it to work using s2ram.

 

You'll also need the libx86 package. Forum member kricker has helpfully provided this along with s2ram. See this post in the discussion thread I linked for you above.

 

If you need further help it would probably be better to continue your questions under that thread.

 

Ok. I am download needed files and modify s3_notHrHdTcpIp.sh:

			# Go to sleep
				/boot/custom/bin/s2ram -f -p -s
	  			echo 3 > /proc/acpi/sleep

 

I try it tomorrow. Very thanks.

Link to comment

Ok. I am download needed files and modify s3_notHrHdTcpIp.sh:

			# Go to sleep
				/boot/custom/bin/s2ram -f -p -s
	  			echo 3 > /proc/acpi/sleep

 

I try it tomorrow. Very thanks.

 

You should not combine both commands. s2ram takes the place of echo 3 > /proc/acpi/sleep

 

Unless you have already tested them, those parameters (-f -p -s) may or may not work with your motherboard. It's better to test the parameter combinations from the console before building them into your script.

 

This is explained here

The best way to start investigating an unknown machine is probably ...

s2ram -f

if the first try already succeeds, everything is fine. ... If it doesn't, try the following variations:

    * s2ram -f -a 3
    * s2ram -f -a 2
    * s2ram -f -a 1
    * s2ram -f -p -m
    * s2ram -f -p -s
    * s2ram -f -m
    * s2ram -f -s
    * s2ram -f -p
    * s2ram -f -a 1 -m
    * s2ram -f -a 1 -s 

If none of those combinations work, start again but add the "-v" switch. 

Link to comment

Hi all,

 

I am trying to get s3_notHrHdTcpIp to work from the go script, but I keep getting an error and it does not run.  The error is:

 

Feb 21 16:49:00 Tower atd[2174]: Exec failed for mail command: No such file or directory

 

If I copy what I have in my go script a line at a time into a telnet session it works fine.  These are the lines I added to my go script.  Funny thing is I have no mail packages installed.

 

cd /boot/custom/Server_Scripts

chmod +x s3_notHrHdTcpIp.sh

echo "s3_notHrHdTcpIp.sh" | at now + 1 minute

You can ignore the error, unRAID has no mail command , therefore "at" cannot mail to you the fact the command was started.

Thanks Joe L.  I remember reading about that now and since I had unmenu running it wouldn't sleep.

Link to comment

lewcass, very thanks.

 

s2ram -f -p -m work fine for me. I have intel graphics.  Very thanks again  ;D

 

 

edit:

I am add notification message through NETCAT before sleep (Tower sleeping... ) and after wakeup (call check_unraid.sh).

 

s3_notHrHdTcpIp.sh very, very helpful script.

Link to comment

Remove echo and remove " around the script name

Remove echo and remove " around the script name

You must use "echo" if you are using "at" as it expects the command to be run as its standard input.

The quotes around the script name are not needed as there are no special characters.

 

Joe L.

 

I tried removing the echo and the quotes with no luck getting unmenu to load.  I then tried it with the echo command back in-minus the quotes and no luck again.  No errors in the syslog either.

 

Thanks again,

Cliff

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.