[mythtv-users] Re: VNC launches second mythfrontend

Larry K lunchtimelarry at gmail.com
Tue Apr 19 19:18:10 UTC 2005


Jarod's "power button" script looks like this:

#!/bin/bash
PROG=mythfrontend
STATUS=`ps -e | grep $PROG | grep -v grep | wc -l | awk '{print $1}'`

if [ $STATUS -eq 0 ]
then
( $PROG & )
else
killall $PROG
fi
exit 0

Interestingly, I discovered that I could cause 2 instances of mythfrontend, 
even though it checks for a running instance before it starts another one. I 
could do a ps -ef | grep frontend and see nothing running, then hit the 
power button on my remote, and then see 2 instance running. 

Does this make sense given that the script is checking for a runnning 
instance? 

On 4/19/05, Allan Risk <arisk at hamster.foxhollow.ca> wrote:
> 
> 
> >>>Here's my theory. If anyone has suggestions on how to avoid this it
> >>>would
> >>>be most welcome.
> >>>
> >>>I use Jarod's ~/.kde/Autostart/myth-load.sh, which among other things
> >>>starts
> >>>mythfrontend.
> >>>Since vnc starts a new KDE session, I think this gets run again for the
> >>>vnc
> >>>session and therefore mythfrontend starts a second time.
> >>>
> >>>I would think this would be common as I suspect many people use both
> >>>Jarod's
> >>>script and vnc.
> >
> > add the following into your myth-load.sh file:
> >
> > ---
> > MYTH="`ps ax | grep mythfrontend | grep -v grep`"
> >
> > if [ ! "$MYTH" ]
> > then
> > # place all stuff you want to run with mythfrontend here
> > /path/to/bin/mythfrontend
> > fi
> > ---
> >
> > that checks for a running mythfrontend process and only executes the 
> code
> > inside the if/then if there isn't already a mythfrontend process running
> > ...
> >
> > -g-
> 
> I tried this method first as I thought this was a nicer way to deal with 
> it.
> 
> It worked, but backwards.
> It appears that as the vncservice starts the first mythfrontend.
> Then when the desired mythfrontend should get started it can't because the
> script sees it as already running.
> 
> It is nice to see I'm not alone on this though.
> I prefer to keep the vnc service on.
> I'll look into the other solution about the windows manager. I'll have to
> do more reading about that and educate myself.
> 
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mythtv.org/pipermail/mythtv-users/attachments/20050419/7f2956ba/attachment.htm


More information about the mythtv-users mailing list