[mythtv-users] sudo nice --5 xine Permissions?

Jon Boehm boehm100 at comcast.net
Tue Aug 28 17:54:46 UTC 2007


Andrew Burgess wrote:
>> I'm experimenting with DVD players that have dvdnav.  Currently xine is 
>> the front runner but I still get the occasional dropped frame even after 
>> increasing its buffer size.
> 
>> So I want to try increasing its run time priority.  I have a script, 
>> dvd.sh, that  kicks off xine in the DVD Player field of Myth.  The OS is 
>> punting because of the "sudo nice --5."  How do I tell the OS that 
>> anyone can run dvd.sh and they don't need to be root to do this.
> 
> I don't know how to do that for the script.
> 
> But, perhaps of interest, I set xine to realtime priority to
> get it to work well on a busy server. I also set the i/o
> priority. "Works for me." (tm)
> 
>   chrt --verbose --fifo --pid 10 $PID
>   ionice -c1 -p $PID
> 
> I suppose you could run a little shell script daemon
> as root and look for xine processes periodically...
> 
> or if you don't have multiple users to worry about just
> allow the owner of the myth process to sudo without a
> password, that's in the sudo config file.
> 
> HTH
> 
> PS chrt and ionice are in the util-linux package.
> 
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
> 


For posterity this is what I ended up doing:

################# dvdlaucher.sh #######################
#!/bin/sh

killall xine

# this section places xine on the same screen as the frontend
# I have two screens.
f=$(/bin/ps axu | /bin/grep mythfrontend | /bin/grep :0.0)
if [ "$f" ]; then
     DISPLAY=:0.0
else
     DISPLAY=:0.1
fi

/usr/bin/xine -pfhq --post tvtime:method=Greedy2Frame --no-splash dvd:/


################# rtxinemaker.sh #######################
#!/bin/sh
# Checks for the existence of a xine instance and
# gives it real time priority

PID=$(pidof xine)
if [ "$PID" ]; then
   PID_OLD=$(cat /home/jboehm/.xine.pid)
   if [ "$PID" != "$PID_OLD" ]; then
     echo $PID > /home/jboehm/.xine.pid
     chrt --verbose --fifo --pid 10 $PID
     sudo ionice -c1 -p $PID
   else
     d=$(date)
     echo "$d    Running xine found, but not new instance"
   fi
else
   d=$(date)
   echo "$d      No running xine found"
fi




In crontab I added this line single line
* * * * *   root    cd / && /etc/cron.min/rtxinemaker.sh >> 
/var/log/cron.log

It runs the rtxinemaker.sh every minute.

I did this way because the other script mentioned which launched xine & 
(non blocking) screwed up ir control.

Good Luck,
Jon






More information about the mythtv-users mailing list