Project

General

Profile

WakeUp Tutorial some Questions

Added by hackbird hackbird about 7 years ago

Hello,

on my NAS i installed OMV and TVHeadend.
The Tutorial from here: https://tvheadend.org/projects/tvheadend/wiki/Wakeup
i got in use. I installed sucessfully and broadcasts which i programmed are recording. It wakes up and after it shutdowns.
But i got some erros.

1. Alle my recordings are on "Failed Recordings" with the Error "Subscription Override"

2. The recordings start 3 minutes for beginning the shows but it stops to early. In TVHeadend webgui i set 3 minutes for and after recording.

Here is my "Timer_sh" script which i use:

_______________________________________________________________________________
#!/bin/bash #
  1. set ACPI Wakeup alarm
  2. safe_margin - minutes to start up system before the earliest timer
  3. script does not check if recording is in progress # #

echo 1 > /timer

  1. bootup system 60 sec. before timer
    safe_margin=60
  1. modyfy if different location for tvheadend dvr/log path
    cd ~hts/.hts/tvheadend/dvr/log

######################

start_date=0
stop_date=0

current_date=`date +%s`

for i in $( ls ); do
tmp_start=`cat $i | grep '"start":' | cut -f 2 -d " " | cut -f 1 -d ","`
tmp_stop=`cat $i | grep '"stop":' | cut -f 2 -d " " | cut -f 1 -d ","`

  1. check for outdated timer
    if [ $((tmp_stop)) -gt $((current_date)) -a $((tmp_start)) -gt $((current_date)) ]; then
  1. take lower value (tmp_start or start_date)
    if [ $((start_date)) -eq 0 -o $((tmp_start)) -lt $((start_date)) ]; then
    start_date=$tmp_start
    stop_date=$tmp_stop
    fi
    fi
    done

wake_date=$((start_date-safe_margin))

echo $start_date >> /timer
echo $wake_date >> /timer

  1. set up waleup alarm
    if [ $((start_date)) -ne 0 ]; then
    echo 2 >> /timer
    echo 0 > /sys/class/rtc/rtc0/wakealarm
    echo $wake_date > /sys/class/rtc/rtc0/wakealarm
    fi
    _____________________________________________________________________________
    
    And this is my shutdown script:
    
    _______________________________________________________________________________
    #!/bin/sh
    
    # Here you can invoke your script for recording's post-processing
    #exec <your_script.sh>
    sleep 20
    sudo /usr/sbin/pm-suspend &
    ________________________________________________________________________________
    
    Must i do something in the shutdown script??