[mythtv-users] Mythfilldatabase during recording screws up recordings.

Alex Butcher mythlist at assursys.co.uk
Mon Apr 4 22:01:21 UTC 2011


On Mon, 4 Apr 2011, Douglas Peale wrote:

> On 04/04/2011 01:48 PM, Alex Butcher wrote:
>> On Sun, 3 Apr 2011, Douglas Peale wrote:
>>
>>> Is there any way to prevent mythfilldatabase from running simultaneous to a recording? Can something be done in the scheduler to
>>> keep them separate?
>> Why not use ionice? I run mysqld, mythfrontend and mythbackend with 'ionice
>> -c 2' and run all the IO-heavy tasks run by MythArchive and my commflagging
>> wrapper script with 'ionice -c 3' so that they don't disrupt recordings or
>> playback.  mythfilldatabase is probably another candidate for the same
>> treatment, so I've just enabled that on my system.

[...]

> Care to elaborate on how you implement this?

--- /etc/rc.d/init.d/mythbackend.fedora	2011-01-20 23:08:09.650056748 +0000
+++ /etc/rc.d/init.d/mythbackend	2011-02-12 20:09:09.233178903 +0000
@@ -36,7 +36,8 @@
    fi
    export MYTHCONFDIR="$MYTHTV_HOME"
    export HOME="$MYTHTV_HOME"
-  daemon $binary $OPTIONS
+  # add ionice -c 2 -n 0 AJB20110120
+  daemon ionice -c 2 -n 0 $binary $OPTIONS
    RETVAL=$?
    echo
    [ $RETVAL = 0 ] && touch /var/lock/subsys/$prog


--- /etc/rc.d/init.d/mysqld.fedora	2011-01-20 23:08:24.259515784 +0000
+++ /etc/rc.d/init.d/mysqld	2011-01-20 23:11:11.200950806 +0000
@@ -96,7 +96,8 @@
  	# and some users might prefer to configure logging to syslog.)
  	# Note: set --basedir to prevent probes that might trigger SELinux
  	# alarms, per bug #547485
-	$exec   --datadir="$datadir" --socket="$socketfile" \
+	# add ionice -c 2 -n 1 AJB20110120
+	ionice -c 2 -n 1 $exec   --datadir="$datadir" --socket="$socketfile"
\
  		--pid-file="$mypidfile" \
  		--basedir=/usr --user=mysql >/dev/null 2>&1 &
  	safe_pid=$!

For mythfrontend, it'll depend on how you start and restart it, but
essentially you want to prefix it with "ionice -c 2 -n 0" like mythbackend.

> In myth backend setup, under "General" on the Mythfilldatabase page there is a line for "mythfilldatabase program:" and a line
> for "mythfilldatabase arguments:", so there is no place I can alter the command line to include ionice.
>
> I suppose I could replace the mythfilldatabase.sh script with my own that calls mythfilldatabase.sh, but then I would have to
> figure out how to make sure my script passes the proper options to the mythfilldatabase.sh script. Risky for one with minimal
> script writing experience.

Exactly. I use this:

#!/bin/sh
echo "mythfilldatabase started `date`"
>>/var/lib/mythtv/mythfilldatabase.log
echo "Parameters:" >>/var/lib/mythtv/mythfilldatabase.log
for i in $*
do
 	/bin/echo -n "<$i> " >>/var/lib/mythtv/mythfilldatabase.log
done
echo "User: `whoami`" >>/var/lib/mythtv/mythfilldatabase.log
echo "Groups: `groups`" >>/var/lib/mythtv/mythfilldatabase.log
echo "PWD: `pwd`" >>/var/lib/mythtv/mythfilldatabase.log
echo "Environment: " >>/var/lib/mythtv/mythfilldatabase.log
export >>/var/lib/mythtv/mythfilldatabase.log

su -c "ionice -c 3 nice /usr/bin/mythfilldatabase $*" mythtv

HTH,
Alex


More information about the mythtv-users mailing list