The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

Views: 15,112     Votes:  3 
Tags: suspend   cron   rtc  
Link: 🔍 See Original Answer on Ask Ubuntu 🔗

URL: https://askubuntu.com/q/1012051
Title: Sleep & Wakeup Schedule | Ubuntu 16.04.3 LTS
ID: /2018/03/05/Sleep-_-Wakeup-Schedule-_-Ubuntu-16.04.3-LTS
Created: March 5, 2018    Edited:  June 12, 2020
Upload: November 24, 2022    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false


The script you are following is overly complicated. A simpler method is described here.

Before a full implementation of 1am sleep and 6am wake, you can do a simple 10 second test:

sudo rtcwake -m mem -s 10 && firefox

This test will ensure suspending to RAM actually works. Upon resuming firefox is automatically started up.

Rather than messing around with UTC, have your rtcwake command called from cron at 1am and wake up 18000 seconds later. Your cron table entry would look something like this:

0 1 * * *  sh /usr/sbin/rtcwake -m mem -s 18000 >> /home/Me/SuspendResume.log 2>&1

There is no need for sudo prefix because cron runs with sudo privileges.

Replace Me with your user name. Check the file SuspendResume.log for cron messages periodically and whenever there is a problem. 2>&1 option redirects error messages to the .log file.

Caveats

⇧ Automounted USB devices are read only Print screen key opens default browser on Kubuntu. How to fix?  ⇩