<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<pre wrap="">
    &gt; Date: Sat, 2 Dec 2006 02:37:06 -0500
    &gt; From: Chris Pinkham <a class="moz-txt-link-rfc2396E"
 href="mailto:cpinkham@bc2va.org">&lt;cpinkham@bc2va.org&gt;</a>

    &gt; &gt; With your inuseprograms table and knowledge of which disks and
    &gt; &gt; encoders are in use, would it be possible to do these tasks
    &gt; &gt; when the system is quiet?

    &gt; I believe so.  The housekeeper could do something like this:

    &gt; void HouseKeeper::RunHouseKeeping(void)
    &gt; {
    &gt; ...
    &gt;     if ((wantToRun("DailyDBTasks", 1, 0, 24)) &amp;&amp;
    &gt;         (SystemIs<span id="mail-highlight-id"
 style="background-color: yellow;">Idle</span>()))
    &gt;     {
    &gt;         RunExternalDailyDBTasksScript();
    &gt;         updateLastrun("DailyDBTasks");
    &gt;     }
    &gt; ...
    &gt; }

    &gt; That way the backup/optimize never actually runs until the system is <span
 id="mail-highlight-id" style="background-color: yellow;">idle</span>.
    &gt; With this, it may make sense to include a script that does do the check,
    &gt; optimize, and backup.  The name could be a setting if the user chose to
    &gt; use their own, but otherwise we'd use the stock one.  Could probably take
    &gt; advantage of or extend the perl bindings some for this.

    &gt; Anything that is recording or in use by some form of playback should be in
    &gt; the inuseprograms table.  The only notable exceptions that I know of
    &gt; for this are MythArchive and nuvexport when it's not using mythtranscode.
    &gt; That makes it easy to check whether we're <span
 id="mail-highlight-id" style="background-color: yellow;">idle</span> or not.  That covers
    &gt; the MythTV portion.  We know nothing about plugins, but we probably don't
    &gt; care either.

&gt;Does this also manage to avoid system-about-to-become-non<span
 id="mail-highlight-id" style="background-color: yellow;">idle</span>?
&gt;E.g., you want to make sure the optimize/backup doesn't -start-
&gt;within some configurable time (on the order of a couple of minutes)
&gt;of when any encoder is -going- to be busy.  This requires at least
&gt;some interaction with the scheduler, but no more than MythWeb's
&gt;"Status" page has.


I'm not sure what you guys are talking about and how this relates to LiveTV channel switching, However I like the idea of scheduled MYSQL backups and other daily jobs that won't interfere with upcoming recordings. I think this could be started by Mythwelcome. When the system is idle, and there are no recordings about to start (in a configurable period of time) Mythwelcome will set the next time to wake up and then run the shutdown command. In addition, perhaps it could kick off a daily job if there is one, and wait again for the idle time. 

The Mythwelcome doc is on the wiki:

        <a class="moz-txt-link-freetext" href="http://www.mythtv.org/wiki/index.php/Mythwelcome">http://www.mythtv.org/wiki/index.php/Mythwelcome</a>

Mythwelcome will also prevent the backend from shutting down the system if it is busy commercial flagging, downloading EPG data, transcoding or shutdown has been locked by a user.


</pre>
</body>
</html>