[mythtv-users] mythlogserver fixes/0.26 OS-X?

Craig Treleaven ctreleaven at cogeco.ca
Sat Feb 16 20:49:59 UTC 2013


At 1:34 PM -0800 2/3/13, dgktkr wrote:
>At 8:21 PM -0500 2/2/13, Craig wrote:
>  > At 3:50 PM -0800 2/2/13, Glenn wrote:
>>>  FWIW, I've found a solution that works for me:
>>>  http://code.mythtv.org/trac/ticket/10890
>>
>>  That's not a 'solution'; it is a blunt-force hack to work around the
>>  problem.  Check Console.app and I expect you'll find that, when no
>>  myth program is running, mythlogserver quits every 5 minutes and
>>  launchd fires up a new copy.  Possibly waking the machine from sleep?
>>
>>  If you leave the backend running all the time, I guess it is no harm.
>>  For a machine that's intermittently used as a frontend, it will waste
>  > a lot of memory.
>I agree, it would be better if the main Myth programs would invoke 
>mythlogserver in a way that worked well
>for Macs. ...

OK, I've been doing some more testing.  I've found that, on OS X, I 
can't let Myth launch mythlogserver.  If launched with the --daemon 
flag, OS X refuses to run it.  If I patch out the --daemon flag, it 
launches OK but the program that caused it to launch (eg mythfrontend 
or mythtv-setup) will appear to hang when you try to exit.  If you 
wait for the 5 minute timer to elapse, mythlogserver will quit and 
_then_ your program will finish.  Pretty undesirable behaviour.

My thought is to use a wrapper script around the main programs that 
uses 'ps -Ax' to check if mythlogserver is already running.  If not, 
launch it before launching the desired program.  My knowledge of 
scripting isn't very advanced however...

Questions:
1) Is it as easy appending an "%" to the mythlogserver args to start 
it in the background before launching another Myth program?  Does it 
make a difference if this wrapper script (say for mythbackend) is 
going to be executed as a system daemon by launchd?

2) Does my wrapper script need to handle signals?  I would guess that 
the script needs to pass them through to the wrapped program and to 
mythlogserver if we were the ones that launched mythlogserver? 
Basing this on:

https://developer.apple.com/library/mac/#documentation/opensource/Conceptual/ShellScripting/AdvancedTechniques/AdvancedTechniques.html#//apple_ref/doc/uid/TP40004268-TP40003521-SW8

Any other gotcha's that I should be aware of?

Craig


More information about the mythtv-users mailing list