Jarod's &quot;power button&quot; 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>

&nbsp;&nbsp;&nbsp;&nbsp;( $PROG &amp; )<br>

else<br>

&nbsp;&nbsp;&nbsp;&nbsp;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.&nbsp;&nbsp; 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.&nbsp; <br>
<br>
Does this make sense given that the script is checking for a runnning instance?&nbsp; <br><br><div><span class="gmail_quote">On 4/19/05, <b class="gmail_sendername">Allan Risk</b> &lt;<a href="mailto:arisk@hamster.foxhollow.ca">
arisk@hamster.foxhollow.ca</a>&gt; 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>&gt;&gt;&gt;Here's my theory.&nbsp;&nbsp;If anyone has suggestions on how to avoid this it
<br>&gt;&gt;&gt;would<br>&gt;&gt;&gt;be most welcome.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;I use Jarod's ~/.kde/Autostart/myth-load.sh, which among other things<br>&gt;&gt;&gt;starts<br>&gt;&gt;&gt;mythfrontend.<br>&gt;&gt;&gt;Since vnc starts a new KDE session, I think this gets run again for the
<br>&gt;&gt;&gt;vnc<br>&gt;&gt;&gt;session and therefore mythfrontend starts a second time.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;I would think this would be common as I suspect many people use both<br>&gt;&gt;&gt;Jarod's<br>&gt;&gt;&gt;script and vnc.
<br>&gt;<br>&gt; add the following into your myth-load.sh file:<br>&gt;<br>&gt; ---<br>&gt; MYTH=&quot;`ps ax | grep mythfrontend | grep -v grep`&quot;<br>&gt;<br>&gt; if [ ! &quot;$MYTH&quot; ]<br>&gt; then<br>&gt;&nbsp;&nbsp; # place all stuff you want to run with mythfrontend here
<br>&gt;&nbsp;&nbsp; /path/to/bin/mythfrontend<br>&gt; fi<br>&gt; ---<br>&gt;<br>&gt; that checks for a running mythfrontend process and only executes the code<br>&gt; inside the if/then if there isn't already a mythfrontend process running
<br>&gt; ...<br>&gt;<br>&gt; -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.&nbsp;&nbsp;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>