Project

General

Profile

rtc-wakeup error

Added by Christoph K. almost 8 years ago

Hi everyone,

I currently have a problem where I can not get any further.
First the initial situation. I use omv 2 with tvheadend. This runs stable.
I use the autoshutdown-plugin to set the NAS to hibernate.

To wake up to timer recordings I had this script :


#!/bin/bash
#
# set ACPI Wakeup alarm
# safe_margin - minutes to start up system before the earliest timer
# script does not check if recording is in progress
#
#
echo 1 > /timer
# bootup system 60 sec. before timer
safe_margin=300
# modyfy if different location for tvheadend dvr/log path
cd /home/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 ","`
    # check for outdated timer
    if [ $((tmp_stop)) -gt $((current_date)) -a $((tmp_start)) -gt $((current_date)) ]; then
        # 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
# 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

But actually it doesn't work anymore. The faliure is that the script
give this error:

root@openmediavault:/home/hts/.hts/tvheadend/dvr/log# /etc/pm/sleep.d/95_wakeuptimer
/etc/pm/sleep.d/95_wakeuptimer: Zeile 21: 1469388900
1469389380: Syntaxfehler im Ausdruck. (Fehlerverursachendes Zeichen ist \"1469389380\").
root@openmediavault:/home/hts/.hts/tvheadend/dvr/log# date +%s
1488879520
root@openmediavault:/home/hts/.hts/tvheadend/dvr/log#

This log from an old record is for testing in the directory. But the error appears with each
old logfile i have testet.

{
    "enabled": true,
    "start": 1469384100,
    "start_extra": 0,
    "stop": 1469388900,
    "stop_extra": 0,
    "channel": "58ed1ba7c62a94a01de1c9a4d0e5ba69",
    "channelname": "Sky Cinema",
    "title": {
...

if there is no "old" log file and only a file for an upcomming timer the script works and
the NAS wakes up correctly.
But i need the Old logs for my old records ?!?

I'm using
OMV 2.2.13 (Stoneburner | Debian Wheezy)
and
Tvheadend 4.1-2409~g4db3eec~wheezy

Can anyone help me with this problem.

P.S.: my Preferred Language is German so excuse my english.