Code & instructions needed to shutdown/boot up Linux Mint automatically
January 8, 2015 5:48 PM   Subscribe

Hello everyone. I've put together a new Intel NUC and have installed Linux Mint 17.1. I need the machine to be able to do a few things automatically. I need it to power off at 10pm every day. I also need it to power on at 7am every day.

I don't know too much about Linux, but have been able to find a few things that are a bit confusing to me. Mainly using rtcwake command with the appropriate code and combining that into a cron script in order to automate the process.

I'm not sure if that's the way to go, or if there's a piece of software that would give me a GUI to do all of this a little easier.

Thanks for the help.
posted by Jackie_Treehorn to Computers & Internet (4 answers total) 2 users marked this as a favorite
 
rtcwake is exactly what you're after, except on some systems it can't wake from actual power-off. If this is the case, the system would need to be suspended instead of powered down - this shouldn't make any difference to you unless you plan on removing power (via the power point) during the "off" time.

To test it, run this:

sudo rtcwake -s 60 -m off

which should shut it down, wait 60 seconds, then power back on again. If that doesn't work try

sudo rtcwake -s 60 -m mem

which does a suspend-to-ram for 60 seconds and should almost certainly work. Once you've checked which of these you can use, make a file at /etc/cron.d/daily-sleep-and-wake containing this single line:

0 22 * * * root rtcwake -s 32400 -m off

(or "-m mem" if "off" doesn't work). This tells the computer to sleep for 32400 seconds (i.e. 9 hours) at 22:00 every day.
posted by russm at 6:15 PM on January 8, 2015 [4 favorites]


There is literally nothing a single line of Linux can't do.

I am agape.
posted by IAmBroom at 8:09 PM on January 8, 2015


do you happen to have a dd-wrt enabled router and have your PC connected via etheret? If so, wake on lan is another option.
posted by harisund at 1:22 AM on January 9, 2015


Out of curiosity, did you get what you wanted to do? How did you end up doing it?
posted by harisund at 8:17 PM on January 13, 2015


« Older Identify These Adventure Time Figures!   |   How do I become a babysitter? Newer »
This thread is closed to new comments.