SetTimer unter Ubuntu (FreeVDR)

  • Ich habe gestern versucht SetTimer unter FreeVDR2.0e zum laufen zu bringen.
    Habe mich dabei weitestgehend an die Anleitung für den CT-VDR gehalten, sollte ja so passen.
    HWClock=no ist gesetzt, Bios steht auf UTC.
    Die Zeit wird zwar verändert, aber die Uhr wird meist einfach auf 22.00 Uhr, 31.7.2001 gesetzt.
    Zurückstellen funktioniert auch.
    Gelegentlich sieht´s so aus als würde ein dem Timer entsprechender Wert geschrieben, aber das haut nicht hin, da der Zeitunterschied einfach nicht richtig ist zum "echten" WakeUp Zeitpunkt.
    Kann mir das mal jemand Step by Step, quasi für Idioten erklären?
    ACPI Wakeup funktioniert nicht bei meienr Kiste, lediglich aus dem S4 klappts, aber da hängt sich der rechner alle paar Shutdown Vorgänge auf und versaut damit die nachfolgenden Aufnahmen. :/

  • uff, viel Glueck! Auf die verstaendliche Anleitung, wie man settimer unter einer Distri XY ans laufen kriegt warte ich auch schon seit langem. Fuer einen stand-alone VDR die optimale Wakeup-Methode, aber ich habe mich bisher an die Basics auch noch nicht getraut...

  • Ich habe mittlerweile das settimer Script aus dem nvram-wakeup paket eingebaut und ACPI-Wakeup
    rausgeschmissen.
    Bringt mir keine Nachteile, aber ein Problem wäre da...
    Wenn fsck normal eim start ausgeführt wird, passt das natrlich alles nicht, weil ja das Datum weit in der Vergangenheit liegt.
    Behelfsmäßig habe ich den fsck in der fstab erstmal abgeschaltet, dass ist natürlich keine tolle Lösung.


    Derzeit wird das Script in den Shutdown-Hooks als S90.set_timer.sh um die Uhr zu verstellen sowie am Anfang der /etc/init.d/bootmisc.sh aufgerufen
    um die richtige Zeit wieder mittels hwclock zurckzuschreiben.
    Vorher will leider schon der fsck ran, welcher mir beim starten allerdings eh nicht passt.
    Den fsck auf den Shutdown zu verlegen wäre die klügste Lösung, allerdings müsste dieser ja nach dem unmount der Platte erfolgen,
    dann kann aber das Script nicht mehr das time-diff File schreiben.


    Hat da wer eine Lösung?



    Das Script ist weitestgehend unverändert, es sind nur die Pfade etwas angepasst:


    set -x
    #!/bin/bash
    #
    # $Id: set_timer 908 2008-11-23 13:29:13Z tiber $
    #
    # This script was made by Hans-Hermann Redenius (redenius@gmx.de)
    #
    # This file is for bioses nvram-wakeup couldn't handle, because there is
    # no possibility to change the Wake on RTC time in the nvram
    # The wake up time must be set to 23:59:59 the day must be set to 31
    # if your board supports a month setting for the wakeup, set it to July
    #
    # The System should not update the hardware clock in the shutdown process.
    # In Debian Woody set HWCLOCKACCESS=no in /etc/default/rcS
    #
    # in vdrshutdown replace:
    #
    # $NVRAMCMD -ls $1
    #
    # by
    #
    # $PATH_TO_SET_TIMER/set_timer $1 $2
    #
    # and add the following line to your start script before vdr is started
    #
    # $PATH_TO_SET_TIMER/set_timer
    #
    # The time command from nvram-wakeup is needed (set the path bwlow)
    #
    # Thanks to Sergei Haller for nvram-wakeup and the time and ideas to develop
    # this script



    # programs to use:
    HWCLOCK=/sbin/hwclock
    TIME=/usr/local/sbin/time


    # files to use:
    TIME_DIFF=/media/video/time_diff



    if [ ! -x $HWCLOCK ] ; then
    echo "$0 needs hwclock"
    exit 1
    fi


    if [ ! -x $TIME ] ; then
    echo "$0 needs the time command from nvram-wakeup"
    exit 1
    fi


    # current time
    cur_time=`date +%s`


    # how many seconds before the next event the system should be booted
    boot_time=300


    # if a time_diff file exists the clock is set to the wakeup time and
    # must be fixed before any further action
    #
    if [ -f $TIME_DIFF ] ; then

    # the difference stored
    time_diff=`cat $TIME_DIFF`

    # add the difference to the curent time and change it in the date format
    set_time=$(( $cur_time + $time_diff ))
    set_date=`$TIME $set_time | grep "^(local" | cut -f2- -d')' `

    # restore the correct time and if all is right remove the $TIME_DIFF file
    # because there is no longer a difference
    $HWCLOCK --set --date "$set_date" && $HWCLOCK --hctosys && rm $TIME_DIFF
    fi


    # if there is a parameter given, it is assumed the system schould boot
    # after $boot_time seconds
    if [ -n "$2" ] ; then


    if [ $1 -eq 0 ] ; then # no timer present
    sleep_time=$(( 61 * 24 * 60 * 60 - 1 + $boot_time )) # 61 days - 1s
    # + boot_time
    else # timer present
    if [ $2 -ge $(( $boot_time + 30 )) ] ; then # need 30 seconds for shutdown
    sleep_time=$2
    else
    sleep_time=$(( $boot_time + 30 ))
    # or exit 1 so vdrshutdown would do nothing
    # because the next timer is less than boot_time + 30 seconds in the future
    # or currently recording
    # I suggest a short timeout, because the user really asked for it
    fi
    fi


    # wakeup time
    wake_time=996616799 # date -d "Jul 31 23:59:59 2001" +%s

    # calculate the right time and the time difference
    set_time=$(( $wake_time - $sleep_time + $boot_time ))
    time_diff=$(( $cur_time - $set_time ))


    # convert time to date format
    set_date=`$TIME $set_time | grep "^(local" | cut -f2- -d')' `

    # set date and if it is correct write the time_diff file
    # date --set="$set_date" && \ # add this if a script updates the hwclock
    $HWCLOCK --set --date "$set_date" && echo $time_diff > $TIME_DIFF
    fi

  • Wenn ich das richtig verstehe, könnte ein Korrigieren der Zeit des letzten Checks helfen? Mit tune2fs -T YYYYMMDD[HH[MM[SS]]] <dev> kannst du das machen.
    Der Check wird ja auch noch über den Mount-Count ausgelöst, das reicht ja bei einem System, was regelmäßig genutzt wird - so wie ein VDR eben ;-).

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!