Jarod's "power button" script looks like this:<br>
<br>
#!/bin/bash<br>
PROG=mythfrontend<br>
STATUS=`ps -e | grep $PROG | grep -v grep | wc -l | awk '{print $1}'`<br>
<br>
if [ $STATUS -eq 0 ]<br>
then<br>
( $PROG & )<br>
else<br>
killall $PROG<br>
fi<br>
exit 0<br>
<br>
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. <br>
<br>
Does this make sense given that the script is checking for a runnning instance? <br><br><div><span class="gmail_quote">On 4/19/05, <b class="gmail_sendername">Allan Risk</b> <<a href="mailto:arisk@hamster.foxhollow.ca">
arisk@hamster.foxhollow.ca</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>>>>Here's my theory. If anyone has suggestions on how to avoid this it
<br>>>>would<br>>>>be most welcome.<br>>>><br>>>>I use Jarod's ~/.kde/Autostart/myth-load.sh, which among other things<br>>>>starts<br>>>>mythfrontend.<br>>>>Since vnc starts a new KDE session, I think this gets run again for the
<br>>>>vnc<br>>>>session and therefore mythfrontend starts a second time.<br>>>><br>>>>I would think this would be common as I suspect many people use both<br>>>>Jarod's<br>>>>script and vnc.
<br>><br>> add the following into your myth-load.sh file:<br>><br>> ---<br>> MYTH="`ps ax | grep mythfrontend | grep -v grep`"<br>><br>> if [ ! "$MYTH" ]<br>> then<br>> # place all stuff you want to run with mythfrontend here
<br>> /path/to/bin/mythfrontend<br>> fi<br>> ---<br>><br>> that checks for a running mythfrontend process and only executes the code<br>> inside the if/then if there isn't already a mythfrontend process running
<br>> ...<br>><br>> -g-<br><br>I tried this method first as I thought this was a nicer way to deal with it.<br><br>It worked, but backwards.<br>It appears that as the vncservice starts the first mythfrontend.<br>
Then when the desired mythfrontend should get started it can't because the<br>script sees it as already running.<br><br>It is nice to see I'm not alone on this though.<br>I prefer to keep the vnc service on.<br>I'll look into the other solution about the windows manager. I'll have to
<br>do more reading about that and educate myself.<br><br>_______________________________________________<br>mythtv-users mailing list<br><a href="mailto:mythtv-users@mythtv.org">mythtv-users@mythtv.org</a><br><a href="http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users">
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users</a><br></blockquote></div><br>