LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-05-2017, 08:44 AM   #1
elsmandino
Member
 
Registered: Oct 2009
Posts: 106

Rep: Reputation: 0
How to wake PC from sleep mode for scheduled recordings.


Hello,

After a few teething problems, I am now running TVHeadend on Openmediavault 3.0 and everything is working well.

The problem is, I have to leave the PC on all the time for schedules recordings to run.

Is there any easy way to have the PC suspend to RAM after 10 minutes of inactivity but also automatically wake up for upcoming recordings?

Thanks.
 
Old 04-05-2017, 11:39 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7 / 8
Posts: 3,529

Rep: Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593
Quote:
Originally Posted by elsmandino View Post
Is there any easy way to have the PC suspend to RAM after 10 minutes of inactivity but also automatically wake up for upcoming recordings?
The clue is in the work "suspend", it stops things... that's how suspend works.

If you're looking for a way to save power then consider doing something like using a low-power device like a RasPi to do your recordings, or use the RasPi to fire a "Wake On Lan" packet to your PC at the appropriate time.
 
Old 04-05-2017, 11:58 AM   #3
elsmandino
Member
 
Registered: Oct 2009
Posts: 106

Original Poster
Rep: Reputation: 0
I hate to make comparisons with Windows on Linux forums but my current Windows 10 server has options to allow me tell it to sleep after 10 minutes and automatically resume from sleep for recordings. Most of the day it just sits there, in sleep mode, waking up to record, and then going back to sleep.

Is this control not available in Linux?
 
Old 04-05-2017, 12:03 PM   #4
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7 / 8
Posts: 3,529

Rep: Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593
There's a difference between "sleep" and "suspend".

Sleep is effectively a low power consumption mode that shuts down a lot of external hardware and (with the right processor) slows the clock on the processor to save power. This allows certain processes to continue executing in the background.

Suspend writes the content of RAM to the HD and stops all processes, when the PC comes out of sleep the contents of RAM are reloaded and processes resume.
 
Old 04-07-2017, 12:04 PM   #5
elsmandino
Member
 
Registered: Oct 2009
Posts: 106

Original Poster
Rep: Reputation: 0
Sorry - it seems that I have muddied the waters by using different terms.

According to this:

https://en.wikipedia.org/wiki/Sleep_mode

Sleep mode (Windows) = Suspend to RAM (Linux)

Hibernatiion (Windows) = Suspend to Disk (Linux)

How do you go about setting a Linux PC to "Suspend to RAM" after a certain period of inactivity?
 
Old 04-07-2017, 12:19 PM   #6
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by elsmandino View Post
How do you go about setting a Linux PC to "Suspend to RAM" after a certain period of inactivity?
most linux distributions come with some gui utility called power management or some such; there you'd simply choose appropriate options & timeouts.
which desktop environment (if any) does openmediavault use?
but i'm sure it can be done with command line also.
 
Old 04-11-2017, 04:28 PM   #7
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,950

Rep: Reputation: 513Reputation: 513Reputation: 513Reputation: 513Reputation: 513Reputation: 513
Sorry for the delay in replying, but you can suspend to RAM with automatic wake-up at a preset time.
See the man page of rtcwake, in which you can set either an absolute time to wake up or a relative time to wake up a suspend to RAM.
There is also a pm-suspend command if you want to do an immediate suspend to RAM.
I expect you have to run these commands as root.

rtcwake works on my desktop.
 
Old 04-12-2017, 08:56 AM   #8
elsmandino
Member
 
Registered: Oct 2009
Posts: 106

Original Poster
Rep: Reputation: 0
Bit of an update on this one.

I have decided to switch to Ubuntu Server (16.04LTS) instead - reason being that OMV just didn't seem very stable on my system. Furthermore, the support for Ubuntu is so much bigger that I am finding it much easier to find the answers for all the numerous questions I have.

What I have found, is this, which seems to offer exactly what I want - i.e. put the server into a lower powered state whenever it is idle and then wake it up for any scheduled recordings:

https://github.com/git-developer/autosuspend

I know that Ubuntu is Debian-based. Given that the author used this on Debian 8.0, do you think it should work on my server?
 
Old 04-12-2017, 10:36 AM   #9
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,950

Rep: Reputation: 513Reputation: 513Reputation: 513Reputation: 513Reputation: 513Reputation: 513
I'm not using systemd...

I only tested a single user signed on and set the suspend criteria via GUI as suspend to RAM after one hours keyboard inactivity.
This works.
I set up a root cron job to reissue the wakeup call each morning.

However, if a second GUI user signs on before the suspend takes place, the first user asks for a password, preventing the suspend.
So it doesn't work properly.
Sorry.

It's clearly going to be rather tricky to run cron jobs when the machine is suspended to RAM for part of the day.
 
Old 04-12-2017, 11:06 AM   #10
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by elsmandino View Post
I hate to make comparisons with Windows on Linux forums but my current Windows 10 server has options to allow me tell it to sleep after 10 minutes and automatically resume from sleep for recordings. Most of the day it just sits there, in sleep mode, waking up to record, and then going back to sleep.

Is this control not available in Linux?
Therefore in theory is can be done in Linux too. perhaps by the same means. a script with the sleep command perhaps being the most elementary means of doing this.

call os to sleep by normal means then set the command sleep for whatever amount of time needed. Then when that time is up figure out how to wake it up then call it to make whatever records it needs. Then check to be sure all said records are created and stored then call it to go to sleep again.

repeat
 
Old 04-12-2017, 12:18 PM   #11
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,950

Rep: Reputation: 513Reputation: 513Reputation: 513Reputation: 513Reputation: 513Reputation: 513
The difficulty is that Linux is a multi-user operating system.
 
Old 04-12-2017, 12:57 PM   #12
linux4evr5581
Member
 
Registered: Sep 2016
Location: USA
Posts: 275

Rep: Reputation: Disabled
This would be called Wake-on-LAN, check out the Arch wiki about Wake-on-LAN as it has a guide on how to do it

Last edited by linux4evr5581; 04-12-2017 at 02:57 PM.
 
Old 04-12-2017, 01:23 PM   #13
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,950

Rep: Reputation: 513Reputation: 513Reputation: 513Reputation: 513Reputation: 513Reputation: 513
Wake-on-LAN would require a second computer, for example a Raspberry Pi, to remain continuously active so as to send the wake-up packet at the appropriate time.
But it might be a reliable method.
 
Old 04-12-2017, 01:49 PM   #14
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by elsmandino View Post
https://github.com/git-developer/autosuspend

I know that Ubuntu is Debian-based. Given that the author used this on Debian 8.0, do you think it should work on my server?
i haven't looked at the code, but so far it looks like a viable solution.
but you should look at the code. this is not the sort of software to install & it works.
 
Old 04-12-2017, 02:28 PM   #15
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
yet is not Windows to a mulit-user OS? because one can have more then one user, but never mind -- it is not a server mulit-user system per se' where ones can log in on a single Windows 10 via a dummy terminal. or can they? I have not kept up with Windows... sorry to say just kidding about being sorry on that one.

but that wake up on LAN was my first thought when I read the OP Q.

Last edited by BW-userx; 04-12-2017 at 02:29 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Computer doesn't wake from sleep mode usr345 Linux - Software 4 05-11-2013 09:19 PM
Monitor screen not wake up from sleep mode gabytf Slackware 1 10-27-2012 05:38 AM
sleep mode problem-monitor doesn't wake up linuxandtsm Linux - Newbie 1 05-08-2012 09:03 PM
System goes into sleep mode, can't wake it up. Have to reboot. BHT Linux - Newbie 2 12-16-2008 07:16 AM
Mouse wont wake after sleep mode icedfusion Ubuntu 3 09-11-2006 10:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration