Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: SOLUTION: vdradmin disturbs sleeptimer



e-PUNK-at-no-spam-gmx.de schrieb:

sleeptimer.sh:

#!/bin/sh
echo "svdrpsend.pl HITK Power" | at now

Like with the example above this svdrpsend command could have been ignored by vdr and the system does not shutdown. The workaround could be to call a sleeptimer2.sh via atd :

sleeptimer2.sh:

#!/bin/sh
i=10
while test $i -gt 0 ; do
svdrpsend.pl HITK Power
sleep 5
i=$((i-1))
done

But I think, that's a bit dirty.

Now, I have a better solution for the sleeptimer.sh:

#!/bin/sh
#
# not so simple poweroff command, sleeptimer plugin

logger sleeptimer.sh: Trying to run svdrpsend.pl HITK Power
svdrpsend.pl HITK Power &

(sleep 3 && tail -n100 /var/log/syslog |\
grep -e "sleeptimer.sh: Trying to run svdrpsend.pl HITK Power\|Power button pressed" |\
tail -n1 | grep "Power button pressed" ||\
/usr/local/src/My_VDR-scripts/sleeptimer.sh ) &

The improovement to the sleeptimer2.sh is as follows.
The sleeptimer2.sh sends 10 times this HITK Power. But if the user cancels the shutdown by hitting a key, the sleeptimer2.sh is going on sending HITK Power at least 10 times.
My new solution checks with this tail-and-grep-pipe from the syslog, if the power command has been send correctly. If not, sleeptimer.sh is called recursively again. If the user cancels shutdown the sleeptimer.sh is already finished, and no further shutdown attempts will accure.
I thought this syslog-check is the only way to check if the HITK Power really is accepted by vdr.
I think this example demonstrates very well, what the user has to think about, when using svdrp. Or is there a more simple way to solve my problem?

Marten


--
Hi! I'm a signature virus, copy me in your ~/.signature to help me spread.

Attachment: signature.asc
Description: OpenPGP digital signature


Home | Main Index | Thread Index