Project

General

Profile

Advice on waking server from sleep mode for scheduled recordings.

Added by A L over 7 years ago

Hello,

After a lot of teething problems (due to my considerable inexperience with Linux), I have managed to get TVHeadend up and running on Openmediavault 3.0.

Everything is working really well now, apart from one major thing - getting the server to sleep (suspend to RAM) after 10 minutes of inactivity, plus having the server automatically wake up to to record.

What is the best/easiest way to achieve this?

I did find this

http://www.tvheadend.org/projects/tvheadend/wiki/Wakeup

but as a novice, it looks awfully complicated.

I also found this, but I am not sure it is worth installing Kodi on a headless server, just to get this functionality.

http://forum.kodi.tv/showthread.php?tid=115758

Any help/advice on this would be very much appreciated.

Thanks.


Replies (7)

RE: Advice on waking server from sleep mode for scheduled recordings. - Added by Anthony Thomas over 7 years ago

Have a look here, there's a few suggestions

https://tvheadend.org/boards/5/topics/12775

It's probably not trivial and will need to be tailored to your needs.

RE: Advice on waking server from sleep mode for scheduled recordings. - Added by A L over 7 years ago

Thank you very much for that - that is exactly what I am looking for.

It seems that Christian's script, as referred to here:

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

is exactly what I am after.

As a Linux novice, I am struggling to follow the instructions as to what to do:

_*tvheadend-autosuspend

An extension to Tvheadend that will suspend your system when it is inactive and wake it right before the next scheduled recording.

Suspend can be configured to be one of

suspend
hibernate
hybrid-suspend and
poweroff
Activity means

Tvheadend activity:
Running or upcoming recordings
Subscriptions, e.g. live TV or EPG grabbing
Connected clients, e.g. Kodi or web interface
System activity as defined in the Ubuntu AutoSuspend script, e.g.
Running daemons
Running applications
Connected samba clients
Reachable network clients
This script is based on systemd and does not make use of pm-utils. It has been tested on Debian 8 (Jessie) with Tvheadend build 4.0.8~jessie. It should work on systems that meet the dependencies listed below.

##Prerequisites

systemd (part of Debian 8)
A running Tvheadend service
##Installation

Copy the files from this git repository to your system.
Install the dependencies
rtcwake (package util-linux, part of Debian 8)
netstat (package net-tools, part of Debian 8)
curl
xmlstarlet
jq
On Debian based systems, dependencies may be installed using the command

$ sudo apt-get install util-linux net-tools curl xmlstarlet jq
##Configuration Edit /etc/autosuspend according to your needs. Credentials for tvheadend are required, e.g.

  1. User for access to the Tvheadend REST API
    TVHEADEND_USER=hts
  1. Password for access to the Tvheadend REST API
    TVHEADEND_PASSWORD=hts
    All other values are optional.

It is possible to work with an existing Tvheadend user, but I recommend to create a separate account to keep things clear. The following rights are required:

Web Interface
Admin
Video Recorder
Details on the configuration of system activity can be found in the Ubuntu users wiki (german).

##Links

AutoSuspend
Standby und Wakeup für Tvheadend - Bash-Skript für Ubuntu 14.04
Power-saving techniques - sleep
HowTo wakeup XBMC/TVHeadend for scheduled recording.*_

Could you possibly be give me a an idiot's step-by-step guide (I am definitely an idiot, when it comes to Linux) as to what to do to get this on my server?

RE: Advice on waking server from sleep mode for scheduled recordings. - Added by Robert Cameron over 7 years ago

The hardest part of any tutorial or howto is how quickly they become obsolete. You must also remember that Linux is just the name of the kernel—the brain of the OS if you'll allow the comparison. Your operating system proper is whichever distribution/flavor of Linux you are using, and there are lots.

Briefly looking over the OMV pages, it looks to be based on Debian, but no clue which version. In general their documentation looks to be in quite the sorry state, even in comparison with other Linux distros. Which details about system management and package versions, a top-down howto will be difficult.

Perhaps there is another OMV user here who can help with the particulars. The page you linked to I found quite self-explanatory and seemed to be easy to follow and configure, so I'm not sure what else you are looking for.

RE: Advice on waking server from sleep mode for scheduled recordings. - Added by A L over 7 years ago

Funnily enough, OMV 3 (which is the version I am using) is based upon Debian Jessie, which appears to be the version that the author of the software is using.

I note your comments about OMV - do you think that, as a beginner, I should switch to something like Ubuntu Server, which has more documentation for people staring out with Linux?

I think that the thing is getting me at the moment is the very first step.

If I download the program as a zip file, what do I then do with it?

RE: Advice on waking server from sleep mode for scheduled recordings. - Added by Robert Cameron over 7 years ago

A L wrote:

Funnily enough, OMV 3 (which is the version I am using) is based upon Debian Jessie, which appears to be the version that the author of the software is using.

I note your comments about OMV - do you think that, as a beginner, I should switch to something like Ubuntu Server, which has more documentation for people staring out with Linux?

I think that the thing is getting me at the moment is the very first step.

If I download the program as a zip file, what do I then do with it?

Um, what do you mean "what do I then do with it"? You unzip the files, put them in their respective directories (the files in the etc directory go in /etc, those in usr/local/sbin go in /usr/local/sbin, &c. Then you modify the configuration just as explained, mark the script as executable and you're set.

Perhaps you might want to read through a few general Linux/command line tutorials first to understand how things work in the first place ...

RE: Advice on waking server from sleep mode for scheduled recordings. - Added by A L over 7 years ago

Thank you - if I am struggling with this (and I am getting the feeling that this is as basic as it gets), it really does seem that I am just not anywhere ready to start using Linux yet.

Could you possibly direct me to any tutorials that you think are sufficient to get me to at least a basic level, please? Is there a general go-to for all new Linux users?

I will promise not to come back on here until I have been through it.

RE: Advice on waking server from sleep mode for scheduled recordings. - Added by Robert Cameron over 7 years ago

A L wrote:

Thank you - if I am struggling with this (and I am getting the feeling that this is as basic as it gets), it really does seem that I am just not anywhere ready to start using Linux yet.

Could you possibly direct me to any tutorials that you think are sufficient to get me to at least a basic level, please? Is there a general go-to for all new Linux users?

I will promise not to come back on here until I have been through it.

I'm afraid I don't know any tutorials offhand, but one resource I do recommend is [[https://wiki.archlinux.org/index.php/Main_page]], which is Arch's wiki. Even if you don't use it as your Linux distro, I find the information general enough to apply to most any situation.

There's no need to cease using the forum or Linux until you learn, but I always warn against just blindly following a howto or cut-and-pasting commands without understanding what you are doing, and most importantly why. Howtos are often out-of-date or written for slightly different software, and if you actually understand the foundations of the tutorial, then you can adapt it easily to your own use-case.

In this particular situation, you need to know a few things. By what manner does your system sleep/resume (there are several on Linux)? When is your next scheduled recording? How do you set the BIOS/EFI to wake your machine at a particular time? Once you have the answers to these questions, then putting the pieces together to achieve your goal is much easier.

But there is no Grand Unified Linux Tutorial. Just as there are hundreds of distributions, there are hundreds of tutorials, all of them varying in utility and quality. Search, read, then search some more; you learn by doing, but don't forget to learn to walk before you attempt to run.

    (1-7/7)