[mythtv] [mythtv-users] WOL Slave Backend only when needed

Ma Begaj derliebegott at gmail.com
Wed Dec 19 08:38:56 UTC 2007


2007/12/19, Mitch Gore <mitchell.gore at gmail.com>:
> > 1.  when there are commercial flagging jobs.  I want the slave to do all
>
> >
> > > flagging.  When my combined FE/BE is flagging i get pre-buffers when
> > > watching HD so i would prefer it not to ever do it.
> >
> > Nice idea, I like it.
> >
> > Make your own script (bash or perl) which runs mythcommflagging. It
> > could work like this:
> > 1. check whether slave is online (with ping or something else)
> > 2. if not, run WOL command to wake slave and wait 1-2 minutes to finish
> booting
> > 3. run mythcommflag  (for the slave)
> >
>
>
> So here is what I was thinking...
>
> I need to parse the xml file that is on ip_of_master:3644/xml
> then parse that to leave me with whats in between <JobQueue> and </JobQueue>
> Inside that it appears jobs are listed.  There is a field that lists Status.
>  When this equals 1 a job is in queue. So i need to power on the FE(if its
> not already running), ssh to it, and run the mythjobqueue.
>
> Then, my though was to have the master check the status of the job queue
> every 30 mins.  If there is any pending or in-progress jobs do nothing.  If
> all jobs are status=272 (this means completed)  ssh to the FE and power it
> off.  I think 30mins would be a good timing to not be powering off the
> backend all the time, maybe i should make it longer Thoughts?
>
>
> Anyone be willing to work on a script?  I am not very inclined on scripting
> yet.
>
> also CCing the Dev list.  Devs,  maybe a script isnt the best idea.  Would
> doing this in the backend be easier/better?

I clicked on "send" by mistake :)


JobQueue parsing could be done in perl with something like this,
without using some additional perl packages:

--------------
my $jobqueue= `wget -c -q -O - http://ip_of_master:3644/xml`
$jobqueue =~s/(.*JobQueue>)(.*)(<\/JobQueue)/$2/ig;
--------------

I have no mythtv in front of me to test it or to see what is in
<jobqueue>, but the rest can also be parsed in just a few lines.


You can do it with xml parsing, but my solution from the 1st email is
easier, because you will not have to check the status every 30
minutes. it can also happen that mythcommflag starts running on the
master in these 30 minutes, or?

IMHO, if you replace mythcommflag command in mythtv-setup with your
own shell script which runs WOL if needed and mythcommflag after that,
you will have less to worry.

and Mike wrote the solution for finding schedules (myth_upcoming_recordings.pl):
>> mythbackend --printsched
>>
>> It does show conflicts.  I have some Perl code I wrote to parse it and
>> find the next conflict or the next time a particular tuner is in use.
>> It's not *quite* ready for prime time yet, but I'll share it when it is.
>
> And, for those using trunk, the contrib script
> myth_upcoming_recordings.pl will allow you to display conflicts (and/or
> other info about upcoming recordings).  Unfortunately, it relies on the
> trunk version of the Perl bindings (which won't work with 0.20-fixes),
> so it won't work with 0.20-fixes.


M.


More information about the mythtv-dev mailing list