Jump to content

[solved] editing s3.sh and spin up?


sam_roberts30

Recommended Posts

Posted

I have my server back up and running and I want to make a few changes to fine tweak it to get it running perfectly for me.

 

I came across a problem I didn't foresee. I have decided to put all my DVD rips on the Unraid and the BD rips locally on my media players internal 3TB HDD. I have got all the timers in the s3.sh and spin down timers set exactly how I want them but this causes a problem if I want to watch a DVD rip after a BD rip (E.G. Iron Man BD followed by Iron Man 2 DVD) because by the time the BD has finished the timers have timed out and the Unraid has gone to sleep. Which means I have to either boot the computer to send a WOL packet, reboot the media player (which sends a WOL on startup) or go right down to the basement to press the power button. I have done some searches and found that some people have added a "ping IP address" line to the s3.sh so their Unraid will only sleep if all the disks have spun down AND the client is not ping-able. The problem is no body has posted the code or where to put the code in the script.

 

My question is what do I have to do to get this to work with my sleep script? a link to a page would be helpful or an example of a working code, I have been searching all day and read through hundreds of posts and am still non the wiser.

 

Below is the script I have running at the moment.

 

#!/bin/bash

drives="/dev/sda /dev/sdb /dev/sdc /dev/sdd  /dev/sde /dev/sdf /dev/sdg/dev/sdh /dev/hdb"
timeout=60


count=60
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
    echo 3 > /proc/acpi/sleep

    # Do post-sleep activities
    
    sleep 5

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

 

 

On a side note, do all the drives have to spin up when the server comes out of s3?

Posted

Does [ANYBODY/u] have a sleep script that checks to make sure the drives are spun down AND pings IP adresses to make sure there are no clients running? I have been trying to work it out myself, based on the sleep script in the wiki, but I have absalutely no idea what I am doing.

Posted

Sorry for the late reply, been away for a few days over xmas. I have downloaded the script, thanks by the way...i'd have had no chance of working all that out.

 

Where would i edit the script to meet my needs. Timers, which HDD's to check, which IP's to ping etc? Do i just edit the configuration area? or do is that just an indicator of where to edit in the implementation stuff?

 

 

Posted

And you need also bwm-ng installed

 

And it check all your disk in your server automatic in this section check_HDD_activity()

 

And I have remarked the mover function in this script

 

pre_sleep_activity() {
        #/usr/local/sbin/mover
#echo $(date) Mover Complete
sleep 5
/bin/sync
echo $(date) Sync Complete

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...