S3 sleep at a set time (SF Sleep without SF core?)


Recommended Posts

Hi

I used to use SF to get my server to go to sleep between 11pm - 6am, I've since stopped using SF and gone back to the stock GUI and unMenu due to a few niggling bugs.

 

One thing I'm missing is the ability to sleep the server between these times, how does SF do the whole sleep thing and is it possible to do the same with out SF or its Sleep module installed, can it be done via the go script or something?

 

Thanks in advance.

Link to comment

The easiest way is to add the sleep command to your crontab file.

Add the following lines your go script:

# Set a daily sleep in root's crontab:

# Append new entries to root's crontab:
cat <<-EOF >> /tmp/crontab.root

# Send server to sleep at 23:15 every day
15 23 * * * echo -n mem > /sys/power/state

EOF

# Update root's crontab:
cp /tmp/crontab.root /var/spool/cron/crontabs/root-
crontab /tmp/crontab.root -u root

 

You may want to do a few other things, such as check for network or activity, run the mover before sleeping, etc. You'd need to put these things in a script and call the script from cron instead. Take a look here for further information - although read through to the end of the thread, as there are a few changes that need to be made to the posted script.

 

I don't know how you'd go about waking the server up at a specified time - I think you'd have to get another machine to send a WOL command at 6am?

Link to comment

cron is the tool that lets you schedule tasks at a given time or time interval. The commands and times for those commands to be run are stored in the crontab for each user. unRAID already uses cron to run the mover on a regular basis.

 

There's quite a useful article here about cron, but there's tonnes more information if you search for "cron" on Google ;)

Link to comment

You could also extract the "s3_sleep" script and the "bwm-ng" binary from the simpleFeatures.s3.sleep-1.0.10-i486-1.txz file that comes with simplefeatures. After you installed the package both are under /usr/local/sbin/.

 

Place them on your flash and make sure they are copied to this folder on boot and the s3_sleep script gets executed with the parameters you want. (add the respective commands to your go file)

Link to comment

I extracted the files for you. They are attached to this post. Unzip the folder to the root of your flash drive and edit your "/boot/config/go" file to call the s3_sleep script with your needed parameters.

 

To find out the parameters open a shell (telnet to your server), enter "cd /boot/s3sleep" to go to the directory on your flash and enter "s3_sleep -h".

 

The line you add to your go file will look like this (parameters will propably differ for you):

/boot/s3sleep/s3_sleep -a -c

s3sleep.zip

Link to comment
  • 2 months later...

Hi SlrG/ Anyone Else :)

 

Finally got around to thinking about trying this had a few other issues to sort out before i touched the server.

 

Am i correct in thinking the following command will do what i want?

 

/boot/s3sleep/s3_sleep -a -c -F -S -h 6 -h 7 -h 8 -h 9 -h 10 -h 11 -h 13 -h 14 -h 15 -h 16 -h 17 -h 18 -h 19 -h 20 -h 21 -h 22 -h 23 -m 5 -C 1

 

I want to sleep the server between the hours of 00:00 - 06:00 ignore the cache drive and and wait for 5 mins of array inactivity before sleeping.

 

The -F to force Gigiabit speeds i wasn't sure about and does the -S enable sleep or sleep the server as soon as its executed.

 

If i put that in my go file it should be fine, correct?

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.