Project

General

Profile

Wakeup script

Added by Peter W. almost 8 years ago

Hey!

I was trying to set my server to wakeup on the next timer via this script:

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

It seems it is not up to date anymore...

tmp_start=`cat $i | grep '"start":' | cut -f 2 -d " " | cut -f 1 -d ","`

can return two times when there is a file for that timer which crashes the if condition. Can someone please adapt the script to this? Meanwhile, I changed it using my very little bash scripting skills and google:
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 space in timer and skip if found
if echo $tmp_start | grep -E '[ "]' >/dev/null
then
    continue
fi

# check for outdated timer
if [ $((tmp_stop)) -gt $((current_date)) -a $((tmp_start)) -gt $((current_date)) ]; then

this may not be ideal but it works again :)


Replies (1)

RE: Wakeup script - Added by Peter W. over 7 years ago

Can anyone with extended bash skills pick this up? :)

    (1-1/1)