Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
9
rated 0 times [  9] [ 0]  / answers: 1 / hits: 48666  / 1 Year ago, mon, april 17, 2023, 8:29:34

I want my PC to sleep at 04:58 and wake at 05:15, every day.



How do I do that?


More From » suspend

 Answers
2

You can do (at least half of) this with Gnome Schedule. (sudo apt-get install gnome-schedule) (NB: it gets put in your launcher as Scheduled Tasks, though typing gnome-schedule still brings it up.)



After launching it, "New" -> "Recurrent Task". Fill in the form as you see fit.



The command to hibernate is /usr/sbin/pm-hibernate (Suspend is /usr/sbin/pm-suspend)



In regards to waking up again, please see "How do I schedule waking up from hibernation?"






Alternately, you can install the "power management interface". (sudo apt-get install powermanagement-interface)



Then create a script like this:



#!/bin/bash
# This script puts the system under standby mode for x hours
usage() {
echo "usage: $0 <n-hours>"
echo "where <n-hours> is the number of hours to be on standby"
exit 0

}
if [ $# -ne 1 ]
then
usage
fi

PATH=$PATH:/usr/sbin
hours=$1
echo 0 > /sys/class/rtc/rtc0/wakealarm
echo `date '+%s' -d "+ $hours hours"` > /sys/class/rtc/rtc0/wakealarm
## Edit the above line to get the exact length of hibernation you want
pmi action suspend


And schedule it in the root's crontab.



Source


[#39828] Tuesday, April 18, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tialmes

Total Points: 14
Total Questions: 108
Total Answers: 102

Location: Oman
Member since Thu, Jun 16, 2022
2 Years ago
;