Jump to content
We're Hiring! Full Stack Developer ×

watching movie server went to sleep[SOLVED ]


naxiand

Recommended Posts

like the title writes i was watching a movie and server went sleep....

here is the s3.sh script...some ideas for the server not going into sleep while the drive still spinning?

 


#!/bin/bash

drives="/dev/sda /dev/sdb /dev/sdc dev/sdd dev/sde dev/sdh dev/sdg 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
   echo 3 > /proc/acpi/sleep

   # Do post-sleep activities
   # Force a DHCP renewal (shouldn't be used for static-ip boxes)
   #/sbin/dhcpcd -n
   sleep 5

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

Link to comment

I'll bet the drive with the movie you were watching when it went to sleep was on

sdd, sde, sdg, sdh, or sdf.

 

You incorrectly defined the drives in your script.  You left off the leading "/" on many of them.

 

You have:

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

 

You should have:

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

Link to comment

Archived

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

×
×
  • Create New...