<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>http://172.16.78.1/index.php?action=history&amp;feed=atom&amp;title=TVHeadend_stuff</id>
	<title>TVHeadend stuff - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://172.16.78.1/index.php?action=history&amp;feed=atom&amp;title=TVHeadend_stuff"/>
	<link rel="alternate" type="text/html" href="http://172.16.78.1/index.php?title=TVHeadend_stuff&amp;action=history"/>
	<updated>2026-06-02T11:04:04Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.0</generator>
	<entry>
		<id>http://172.16.78.1/index.php?title=TVHeadend_stuff&amp;diff=196&amp;oldid=prev</id>
		<title>Ian: Created page with &quot;== TVHeadend ==  Recently ditched Myth for TVHeadend.  Script to shut the bloomin' thing down after recording:   &lt;nowiki&gt;#!/bin/sh  export PATH=/home/tvh/bin:/usr/local/bin:/u...&quot;</title>
		<link rel="alternate" type="text/html" href="http://172.16.78.1/index.php?title=TVHeadend_stuff&amp;diff=196&amp;oldid=prev"/>
		<updated>2017-05-30T19:06:32Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== TVHeadend ==  Recently ditched Myth for TVHeadend.  Script to shut the bloomin&amp;#039; thing down after recording:   &amp;lt;nowiki&amp;gt;#!/bin/sh  export PATH=/home/tvh/bin:/usr/local/bin:/u...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== TVHeadend ==&lt;br /&gt;
&lt;br /&gt;
Recently ditched Myth for TVHeadend.&lt;br /&gt;
&lt;br /&gt;
Script to shut the bloomin' thing down after recording:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
export PATH=/home/tvh/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;`curl -s http://script:script@localhost:9981/api/status/connections | tr } '\n' | grep peer | grep -v 127.0.0.1`&amp;quot; != &amp;quot;&amp;quot; ]; then&lt;br /&gt;
        echo &amp;quot;Not shutting down due to active connections&amp;quot; | logger&lt;br /&gt;
        exit 0&lt;br /&gt;
fi&lt;br /&gt;
curl -s http://script:script@localhost:9981/api/dvr/entry/grid_upcoming | grep -q '&amp;quot;sched_status&amp;quot;:&amp;quot;recording&amp;quot;,'&lt;br /&gt;
match=$?&lt;br /&gt;
if [ &amp;quot;$match&amp;quot; != &amp;quot;0&amp;quot; ]; then&lt;br /&gt;
#       echo not recording.&lt;br /&gt;
        next_recording=`curl -s http://script:script@localhost:9981/api/dvr/entry/grid_upcoming | sed &amp;quot;s/.*start_real.:\([0-9]*\).*/\1/&amp;quot;`&lt;br /&gt;
        gap=$(($next_recording-`date +%s`))&lt;br /&gt;
        echo Next recording: `date -d &amp;quot;1970-01-01 $next_recording sec&amp;quot; &amp;quot;+%F %H:%M:%S&amp;quot; -u` | logger&lt;br /&gt;
        if [ $gap -gt 900 ]; then&lt;br /&gt;
                wakeup=$((next_recording-600))&lt;br /&gt;
                wakeup_date=`date -d &amp;quot;1970-01-01 $wakeup sec&amp;quot; &amp;quot;+%F %H:%M:%S&amp;quot;`&lt;br /&gt;
                echo &amp;quot;Waking up at: $wakeup_date&amp;quot; | logger&lt;br /&gt;
                /usr/bin/sudo /usr/sbin/rtcwake -m no -t $wakeup&lt;br /&gt;
                /usr/bin/sudo /sbin/shutdown -P now&lt;br /&gt;
        fi&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
#       echo recording...&lt;br /&gt;
        echo &amp;quot;Still recording. Not shutting down.&amp;quot; | logger&lt;br /&gt;
fi&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ian</name></author>
	</entry>
</feed>