disable script between certain hours


MvL

Recommended Posts

Hi,

 

I used this script (from the wiki) to put my unRAID server to sleep.

 

#!/bin/bash
drives="/dev/sda /dev/sdb"
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 NIC into gigabit mode
  # (might be needed forgets about gigabit when it wakes up)
  ethtool -s eth0 speed 1000
  # 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

 

is it possible to disable this script at certain hours? So the unRAID server stays awake between 6.00 -10.00pm.

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.