[mythtv-users] Mythjobqueue- Automatic start-up?

Tim Scholl tascholl at gmail.com
Tue May 13 14:02:56 UTC 2008


I recently purchased an HDHomeRun , so now my 0.20.2 BE/FE combo (Athlon XP
2500+, FC7) is straining to handle the load of HD playback along with
commflagging (and the brutal scheduler query I cannot seem to conquer).  I
have a newer FE machine (Athlon X2 4800, FC8) that has excess capacity, so I
began investigating how to off-load some work to that machine.  I considered
moving mysql to that machine, but commercial flagging became an obvious
choice since it is soooo CPU-intensive.  That is when I discovered
Mythjobqueue.  :)

>
> I've configured my machines to prevent commercial flagging on the BE/FE,
> and allow it on the FE.  I have successfully tested this by manually
> starting the Mythjobqueue task on the FE machine.  Now, I would like to have
> that task run automatically every time the FE machine comes up (or when the
> mythtv user logs in).  How are you handling this? Does myth have the ability
> to auto-start this task?  Or, can it be a service?  Does it need to run as
> myth user, or can it run as root?
>
> Advice appreciated...
>
> Try setting up this script. It will watch the mythcommflag job and pause
> it when cpu utilization is too high.  It's not mine but works great!  More
> information here


http://mysettopbox.tv/phpBB2/viewtopic.php?t=16027&highlight=pausecommflag

#!/bin/bash
# pause_commflag.sh   v0.1
# Utility to automatically pause & unpause mythcommflag if CPU usage is
above a certain level
# Free for any use.
# Installation:
#  cp pause_commflag.sh /usr/local/bin
#  chmod +x /usr/local/bin/pause_commflag.sh
# Usage: Add to crontab (crontab -e) with logging:
# * * * * * /usr/local/bin/pause_commflag.sh
>>/var/log/mythtv/pause_commflag.log 2>&1
# Usage: Add to crontab (crontab -e) without logging:
# * * * * * /usr/local/bin/pause_commflag.sh


NOWDATE=$(date)
#CPUTHRESHOLD=65
#CPUTHRESHOLD=55
#CPUTHRESHOLD=50
CPUTHRESHOLD=45
PROCCOMMFLAG=`pidof mythcommflag`
if [ -n "${PROCCOMMFLAG}" ]
then
        echo "$NOWDATE   COMMFLAG Process FOUND. Checking Frontend CPU
usage."
        FRONTENDCPU=`top -b -n 1 -u mythtv | grep mythfrontend | cut -c
43-45`
#       echo "Frontend CPU%: $FRONTENDCPU"
        if [ "$FRONTENDCPU" -ge "$CPUTHRESHOLD" ]
        then
                echo "Frontend CPU usage ($FRONTENDCPU %) is greater than
the threshold \
($CPUTHRESHOLD %). PAUSE Commflagging"
                kill -s STOP $PROCCOMMFLAG
        else
                echo "Frontend CPU usage ($FRONTENDCPU %) is less than the
threshold \
($CPUTHRESHOLD %). CONTINUE Commflagging"
                kill -s CONT $PROCCOMMFLAG
        fi
#else
#       echo "No COMMFLAG Process Active"
fi
-- 
Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mythtv.org/pipermail/mythtv-users/attachments/20080513/f050a800/attachment.htm 


More information about the mythtv-users mailing list