NextPVR Forums
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public NextPVR v5 Support Linux v
« Previous 1 2 3 4 5 … 15 Next »
Wake on suspend for recording

 
  • 0 Vote(s) - 0 Average
Wake on suspend for recording
flyingsubs
Offline

Member

Posts: 85
Threads: 14
Joined: Jun 2018
#1
2020-05-22, 08:34 PM
I ran a test where I scheduled a recording and then suspended my computer.  Is there any support or anyone know how to pull this off? Was thinking of have the server be on demand rather than on 24/7

Thanks!
Ben
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 97,314
Threads: 681
Joined: Nov 2003
#2
2020-05-22, 08:40 PM
It'll wake Windows to record, but won't currently wake linux.

Windows made it pretty straight forward. Linux was a bit weak on this front.
flyingsubs
Offline

Member

Posts: 85
Threads: 14
Joined: Jun 2018
#3
2020-05-22, 08:48 PM
Yeah, I'm coming from a windows box. I've been interested in using linux more and figured this would be a good time to learn that.

That's disappointing from linux, but i'm assuming there aren't many usecases that need this.

Thanks for the response
flyingsubs
Offline

Member

Posts: 85
Threads: 14
Joined: Jun 2018
#4
2020-05-22, 08:54 PM
Best tool I found so far is rtcwake, but that would mean when you schedule you'd also need to fire a script with this. Also not sure if this needs sudo and it's reliability
flyingsubs
Offline

Member

Posts: 85
Threads: 14
Joined: Jun 2018
#5
2020-06-12, 03:33 PM
Code:
#!/bin/bash
#npvr Location
cd /var/opt/nextpvr

#Select the start time of scheduled recordings where only times greater than now
cmd="SELECT start_time FROM SCHEDULED_RECORDING WHERE start_time >= datetime('now')"
IFS=$'\n'
scheduled_recording_times=(`sqlite3 npvr.db3 "$cmd"`)

#sorts recording times by datetime
sorted_recorded_times=($(sort -n < <(printf '%s\n' "${scheduled_recording_times[@]}")))

# echo "${sorted_recorded_times[0]}"
# Converts recording time to local time
local_time=(`date --date 'TZ="UTC"'"${sorted_recorded_times[0]}""UTC -1 min"`)
# echo $local_time

#Converts format for rtcwake
rtc_format=`date -d "${local_time}" '+%Y-%m-%d %H:%M:%S'`
# echo $rtc_format

sudo rtcwake -m no --date $rtc_format
I really missed this feature and tried making a script to pull this off.  Not sure if this is something that makes sense to add to NPVR Sub, but I figured I'd post the code. My thought is to have a cron job run every 30 minutes, as well as find a way to run this script on start up.  Ideally it would make sense to run this after a new recording is scheduled.  Also if you are willing to incorporate it into NPVR the only other piece that is missing is to suspend the computer if it was woken from RTCwake as well as the server is idle.  For me I plan to just have the computer suspend after 30 minutes of inactivity which will be better but not perfect.

For the script, this uses rtcwake which is built in to most linux distros.  It navigates to the npvr database, finds the schedule recordings, sorts it and then grabs the next schedule recording,  the next few steps are formatting time and having rtc wake 1 minute before to make sure the computer doesn't miss any of the recordings.

Also open to ideas and improvements!  This is the first "code" I've ever submitted, but I think it should work!

Thanks!
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 97,314
Threads: 681
Joined: Nov 2003
#6
2020-06-12, 08:34 PM
(2020-06-12, 03:33 PM)flyingsubs Wrote: the only other piece that is missing is to suspend the computer if it was woken from RTCwake as well as the server is idle.  For me I plan to just have the computer suspend after 30 minutes of inactivity which will be better but not perfect.
NextPVR has never suspended a computer. On Windows, it lets Windows and the user power management settings take care of this side of things, since NextPVR isn't going to have good visibility of what other things are happening on the machine. I'd expect this to be no different on Linux (ie, NextPVR is not going to know what the processes or jobs are running that shouldn't be interrupted)
Themalletmaker
Offline

Junior Member

United Kingdom
Posts: 8
Threads: 1
Joined: Jun 2020
#7
2021-01-26, 01:37 PM
Hi- Is there any chance this may be addressed in the future?  I was hoping to migrate from a windows environment to ubuntu but would consider a wake from suspend capability essential.
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 97,314
Threads: 681
Joined: Nov 2003
#8
2021-01-29, 07:30 PM
(2021-01-26, 01:37 PM)Themalletmaker Wrote: Hi- Is there any chance this may be addressed in the future?  I was hoping to migrate from a windows environment to ubuntu but would consider a wake from suspend capability essential.
It is on my list to revisit this.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  Recording might have been corrupted by EPG update? careads 1 27 2021-04-18, 08:53 PM
Last Post: mvallevand
  Multiple recurring recordings not recording CDinger 9 173 2021-04-11, 01:44 AM
Last Post: CDinger
  Issues with PVR recording directory meanioni 2 122 2021-03-25, 09:28 PM
Last Post: meanioni
  Not Waking From Suspend dumfy 3 127 2021-01-22, 03:18 PM
Last Post: mvallevand
  Multiple recording directories CDinger 5 271 2020-12-23, 07:43 PM
Last Post: LinuxDVR
  Recording fail error 404 CDinger 4 185 2020-12-21, 02:28 PM
Last Post: CDinger
  Recording service not running at recording time baj1 22 604 2020-11-21, 07:05 PM
Last Post: mvallevand
  Strange recording folder name VCR58 16 496 2020-11-08, 09:13 PM
Last Post: VCR58
  Recording and playing issues gwbraa99 1 194 2020-10-28, 02:53 AM
Last Post: mvallevand
  nothing recording post upgrade. CDinger 2 202 2020-10-25, 09:45 PM
Last Post: CDinger

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode