<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
> So again, the logic for the script is "If it's it running, killall<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
mythfrontend.real (so Mythbuntu then restarts it) and if it's not<br>
running at all start it." but I don't know how to write bash.<br>
</blockquote>
<br></div>
Hi;<br>
<br>
Run this with the FE running and not running. If the output<br>
matches what you expect, replace the echos with your restart<br>
and start-up commands.<br>
<br>
#!/bin/sh<br>
<br>
pgrep mythfrontend.real 2>&1 > /dev/null<br>
<br>
if [ $? -eq 0 ]; then<br>
echo "Already running, put restart command here."<br>
else<br>
echo "Not running, put your start-up command here"<br>
fi</blockquote><div><div><br></div><div>This should work for the entire thing, just create the necessary rcexec entry with this command, no script necessary (untested in rcexec):</div><div><br></div><div> pidof mythfrontend.real && killall mythfrontend.real || <span style="background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px">mythfrontend &</span></div>
<div><br></div><div>I know it looks weird, but it really does work.</div></div><div><br></div><div>Boolean logic doesn't process any more than it has to in Bash... so in an AND... if the left is false, then it doesn't check the right; in an OR, if the left is true it doesn't check the right.</div>
<div><br></div><div>And Bash lets you use application exit codes as the values you your logic. So this basically replicates and if then else structure in one line.</div></div>