[mythtv-users] Limit concurrent instances of mythpreviewgen?

Will Dormann wdormann at gmail.com
Tue May 13 16:48:11 UTC 2014


On 5/13/14, 12:21 PM, Gary Buhrmaster wrote:
> On Tue, May 13, 2014 at 3:42 PM, Will Dormann <wdormann at gmail.com> wrote:
> ....
>> Possible solutions might be to either:
> 
> And a few others....
> 
> 3) Change your browser to limit the number of concurrent
>     connections and/or disable pipelining. 
> 4) Change your web server to limit the number of
>     concurrent connections and/or disable pipelining.

These both seem a bit heavy-handed.


> 5) Just say no to underpowered systems.

So spend a few hundred dollars and time to set up a new system, rather
than write a few lines of bash?   For some, that is probably reasonable.


FTR, here's my current shell script replacement for mythpreviewgen:

-----

#!/bin/bash





mpgcount=`ps aux | grep mythpreviewgen.real | wc -l`
maxmpg=3


while [ "$mpgcount" -gt "$maxmpg" ]; do
  sleep 5
  mpgcount=`ps aux | grep mythpreviewgen.real | wc -l`
done


ionice -c3 nice mythpreviewgen.real "$@"

-----


While mythpreviewgen's parent still enforces a timeout, at least with
this script, you actually get a small number of successful thumbnails
per attempt, rather than a ton of failures.  The proper fix would
probably require a little bit of digging, but this seems good enough for
now.


-WD


More information about the mythtv-users mailing list