<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Nov 3, 2014 at 10:25 PM, Hika van den Hoven <span dir="ltr">&lt;<a href="mailto:hikavdh@gmail.com" target="_blank">hikavdh@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hoi Hika,<br>
<div><div class="h5"><br>
Tuesday, November 4, 2014, 4:19:33 AM, you wrote:<br>
<br>
&gt; Hoi Phil,<br>
<br>
&gt; Tuesday, November 4, 2014, 3:18:22 AM, you wrote:<br>
<br>
&gt;&gt; On Mon, Nov 3, 2014 at 6:32 AM, Phil Bridges &lt;<a href="mailto:gravityhammer@gmail.com">gravityhammer@gmail.com</a>&gt;wrote:<br>
<br>
&gt;&gt; Thanks, Hiko.<br>
<br>
&gt;&gt; I&#39;ve put in your scripts (ignoring the lirc stuff, because I don&#39;t<br>
&gt;&gt; use it), but I&#39;m getting a syntax error:<br>
<br>
&gt;&gt; /etc/init.d/mythfrontend: line 38: syntax error near unexpected token `then&#39;<br>
&gt;&gt; /etc/init.d/mythfrontend: line 38: `        if [ &quot;$(pgrep -u<br>
&gt;&gt; ${MYTH_UID} <a href="http://mythfrontend.re" target="_blank">mythfrontend.re</a>)&quot; ]; then&#39;<br>
<br>
&gt;&gt; Thoughts?<br>
<br>
&gt;&gt; On Mon, Oct 27, 2014 at 3:10 PM, Hika van den Hoven &lt;<a href="mailto:hikavdh@gmail.com">hikavdh@gmail.com</a>&gt; wrote:<br>
<br>
&gt;&gt; Hoi Phil,<br>
&gt;&gt;<br>
&gt;&gt;  Monday, October 27, 2014, 6:58:34 PM, you wrote:<br>
&gt;&gt;<br>
 &gt;&gt;&gt; I&#39;ve recently had to rebuild a couple of my (Gentoo) Myth boxes,<br>
 &gt;&gt;&gt; and I&#39;m not sure exactly what I was using for auto-starting<br>
 &gt;&gt;&gt; Mythfrontend.  What scripts are y&#39;all using for this?<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; I have the following copied from the gentoo-forums and adapted,<br>
&gt;&gt;<br>
&gt;&gt;  in /etc/init.d<br>
&gt;&gt;<br>
&gt;&gt;  #!/sbin/runscript<br>
&gt;&gt;  # Copyright 1999-2006 Gentoo Foundation<br>
&gt;&gt;  # Distributed under the terms of the GNU General Public License v2<br>
&gt;&gt;  # $Header: $<br>
&gt;&gt;<br>
&gt;&gt;  depend() {<br>
&gt;&gt;          use mythbackend<br>
&gt;&gt;  }<br>
&gt;&gt;<br>
&gt;&gt;  start() {<br>
&gt;&gt;<br>
&gt;&gt;          ebegin &quot;Starting MythTV Frontend&quot;<br>
&gt;&gt;<br>
&gt;&gt;          eindent<br>
&gt;&gt;<br>
&gt;&gt;          einfo &quot;Starting mythfrontend&quot;<br>
&gt;&gt;<br>
&gt;&gt;          start-stop-daemon --start --quiet --background \<br>
&gt;&gt;                  --user ${MYTH_UID} \<br>
&gt;&gt;                  --exec /usr/bin/startx \<br>
&gt;&gt;                  -- -- ${MYTH_XOPTS} vt${MYTH_VT}<br>
&gt;&gt;          eend $?<br>
&gt;&gt;<br>
&gt;&gt;          if [ -n &quot;${MYTH_IREXEC}&quot; ]; then<br>
&gt;&gt;<br>
&gt;&gt;                  local name_opt=&quot;${MYTH_IREXEC_NAME:+--name ${MYTH_IREXEC_NAME}}&quot;<br>
&gt;&gt;<br>
&gt;&gt;                  einfo &quot;Starting irexec&quot;<br>
&gt;&gt;                  start-stop-daemon --start --quiet \<br>
&gt;&gt;                          --user ${MYTH_UID} \<br>
&gt;&gt;                          --exec /usr/bin/irexec \<br>
&gt;&gt;                          -- --daemon ${name_opt} ${MYTH_LIRCRC}<br>
&gt;&gt;                  eend $?<br>
&gt;&gt;          fi<br>
&gt;&gt;<br>
&gt;&gt;          eoutdent<br>
&gt;&gt;  }<br>
&gt;&gt;<br>
&gt;&gt;  stop() {<br>
&gt;&gt;          ebegin &quot;Stopping MythTV Frontend&quot;<br>
&gt;&gt;<br>
&gt;&gt;          eindent<br>
&gt;&gt;<br>
&gt;&gt;          # Make an assumption here: if there are any of these programs running<br>
&gt;&gt;          # under MYTH_UID, then this script started them, and now needs to kill<br>
&gt;&gt;          # them.<br>
&gt;&gt;<br>
&gt;&gt;          if [ &quot;$(pgrep -u ${MYTH_UID} irexec)&quot; ]; then<br>
&gt;&gt;                  einfo &quot;Terminating irExec&quot;<br>
&gt;&gt;                  start-stop-daemon --stop --exec /usr/bin/irexec \<br>
&gt;&gt;                          --user ${MYTH_UID} --quiet<br>
&gt;&gt;                  eend $?<br>
&gt;&gt;          fi<br>
&gt;&gt;<br>
&gt;&gt;          if [ &quot;$(pgrep -u ${MYTH_UID} irxevent)&quot; ]; then<br>
&gt;&gt;                  einfo &quot;Terminating irXevent&quot;<br>
&gt;&gt;                  start-stop-daemon --stop --exec /usr/bin/irxevent \<br>
&gt;&gt;                          --user ${MYTH_UID} --quiet<br>
&gt;&gt;                  eend $?<br>
&gt;&gt;          fi<br>
&gt;&gt;<br>
&gt;&gt;          if [ &quot;$(pgrep -u ${MYTH_UID} <a href="http://mythfrontend.re" target="_blank">mythfrontend.re</a>)&quot; ]; then<br>
&gt;&gt;                  einfo &quot;Terminating MythFrontend&quot;<br>
&gt;&gt;                  start-stop-daemon --stop --name <a href="http://mythfrontend.re" target="_blank">mythfrontend.re</a> \<br>
&gt;&gt;                          --user ${MYTH_UID} --quiet<br>
&gt;&gt;                  eend $?<br>
&gt;&gt;          fi<br>
&gt;&gt;<br>
&gt;&gt;          if [ &quot;$(pgrep -u ${MYTH_UID} mythlogserver)&quot; ]; then<br>
&gt;&gt;                  einfo &quot;Terminating mythlogserver&quot;<br>
&gt;&gt;                  start-stop-daemon --stop --name mythlogserver \<br>
&gt;&gt;                          --user ${MYTH_UID} --quiet<br>
&gt;&gt;<br>
&gt;&gt;                  eend $?<br>
&gt;&gt;          fi<br>
&gt;&gt;<br>
&gt;&gt;          if [ &quot;$(pgrep -u ${MYTH_UID} xclock)&quot; ]; then<br>
&gt;&gt;                  einfo &quot;Terminating X&quot;<br>
&gt;&gt;                  start-stop-daemon --stop --name xclock \<br>
&gt;&gt;                          --user ${MYTH_UID} --quiet<br>
&gt;&gt;                  eend $?<br>
&gt;&gt;          fi<br>
&gt;&gt;<br>
&gt;&gt;          eoutdent<br>
&gt;&gt;  }<br>
&gt;&gt;<br>
&gt;&gt;  in /etc/conf.d<br>
&gt;&gt;<br>
&gt;&gt;     # User id that all the processes should run as.<br>
&gt;&gt;     MYTH_UID=&quot;mythtv&quot;<br>
&gt;&gt;<br>
&gt;&gt;     # HOME directory.  Needed to find .xinitrc file and .mythtv directory.<br>
&gt;&gt;     HOME=&quot;/home/${MYTH_UID}&quot;<br>
&gt;&gt;<br>
&gt;&gt;     # X runs on the first VT available.  At the point this script runs during<br>
&gt;&gt;     # system start-up, the gettys haven&#39;t started yet, so the first available VT is<br>
&gt;&gt;     # VT2.  Then, when the getty on VT2 starts, it grabs the keyboard away from X.<br>
&gt;&gt;     # To avoid having to turn off gettys in /etc/inittab, tell X where to find an<br>
&gt;&gt;     # &quot;unreserved&quot; VT.<br>
&gt;&gt;     MYTH_VT=&quot;7&quot;<br>
&gt;&gt;<br>
&gt;&gt;     # If there are any other X server options you want to use, set them here.<br>
&gt;&gt;     MYTH_XOPTS=&quot;-nolisten tcp -br&quot;<br>
&gt;&gt;<br>
&gt;&gt;     # irexec, part of the lirc package, can be used to run commands in response to<br>
&gt;&gt;     # remote control button presses.  If this variable is set, then irexec will be<br>
&gt;&gt;     # started and pointed to the appropriate config file.  Leave this blank or null<br>
&gt;&gt;     # to not start irexec.<br>
&gt;&gt;     MYTH_IREXEC=&quot;yes&quot;<br>
&gt;&gt;<br>
&gt;&gt;     # Name that irexec is configured to respond to in the lircrc file.<br>
&gt;&gt;     MYTH_IREXEC_NAME=&quot;mythtv&quot;<br>
&gt;&gt;<br>
&gt;&gt;     # Where irexec can find the lircrc file.<br>
&gt;&gt;     MYTH_LIRCRC=&quot;${HOME}/.mythtv/lircrc&quot;<br>
&gt;&gt;<br>
&gt;&gt;  and ~/.xinitrc<br>
&gt;&gt;<br>
&gt;&gt;     # .xinitrc<br>
&gt;&gt;     cd<br>
&gt;&gt;     [ -x /usr/bin/nvidia-settings ] &amp;&amp; /usr/bin/nvidia-settings -l<br>
&gt;&gt;     /usr/bin/xset s noblank<br>
&gt;&gt;     /usr/bin/xset s off<br>
&gt;&gt;     /usr/bin/xset -dpms<br>
&gt;&gt;     #~/.screenlayout/set-768x576i.sh<br>
&gt;&gt;<br>
&gt;&gt;     /usr/bin/evilwm \<br>
&gt;&gt;     -snap 10 -bw 1 \<br>
&gt;&gt;     -bg rgb:0/0/3fff -fg rgb:0/0/ffff \<br>
&gt;&gt;     -app xclock/XClock -s \<br>
&gt;&gt;     -app xterm/XTerm -g 116x41+11+25 \<br>
&gt;&gt;     -app xmyth/XTerm -v 0 -g 116x39+11+25 \<br>
&gt;&gt;     -app xstart/XTerm -v 2 -g 116x39+11+25 \<br>
&gt;&gt;     -app xvnc/XTerm -v 3 -g 116x39+11+25 \<br>
&gt;&gt;     -app mythfrontend/Mythfrontend -v 0 &amp;<br>
&gt;&gt;<br>
&gt;&gt;     exec /usr/bin/xterm -name &quot;xmyth&quot; \<br>
&gt;&gt;     -bg rgb:0/0/3fff \<br>
&gt;&gt;     -fg rgb:ffff/ffff/ffff \<br>
&gt;&gt;     -e ~/.scripts/StartMyth.sh &amp;<br>
&gt;&gt;<br>
&gt;&gt;     exec /usr/bin/xterm -name &quot;xstart&quot; \<br>
&gt;&gt;     -xrm &quot;XTerm.vt100.allowSendEvents: true&quot; \<br>
&gt;&gt;     -bg rgb:0/0/3fff \<br>
&gt;&gt;     -fg rgb:ffff/ffff/ffff \<br>
&gt;&gt;     -e /bin/bash &amp;<br>
&gt;&gt;<br>
&gt;&gt;     exec /usr/bin/xterm -name &quot;xvnc&quot; \<br>
&gt;&gt;     -bg rgb:0/0/3fff \<br>
&gt;&gt;     -fg rgb:ffff/ffff/ffff \<br>
&gt;&gt;     -e ~/.scripts/StartVnc.sh &amp;<br>
&gt;&gt;<br>
&gt;&gt;     exec xclock -digital -padding 2 -norender -g -0+0 \<br>
&gt;&gt;     -bg rgb:0/0/3fff \<br>
&gt;&gt;     -fg rgb:ffff/ffff/ffff<br>
&gt;&gt;<br>
&gt;&gt;  and StartMyth.sh<br>
&gt;&gt;<br>
&gt;&gt;  #!/bin/bash<br>
&gt;&gt;  while true; do<br>
&gt;&gt;          /usr/bin/mythfrontend --syslog local7<br>
&gt;&gt;          read x<br>
&gt;&gt;          clear<br>
&gt;&gt;  done<br>
&gt;&gt;<br>
&gt;&gt;  The clock is this way the X-closing application. Running the frontend<br>
&gt;&gt;  from an Xterm makes the log with an Alt-tab visible. The loop lets me<br>
&gt;&gt;  easily restart. (Actually it has a whole menu with reboot, hibernate<br>
&gt;&gt;  etc. options). The vnc script has a similar loop to restart it. The<br>
&gt;&gt;  extra xterm is there in place of a normal text terminal. The TV is<br>
&gt;&gt;  interlaced vga to scart, so I can&#39;t get a normal console other than<br>
&gt;&gt;  ssh.<br>
&gt;&gt;<br>
&gt;&gt; It appears to not like that position of any of the three if/thens. <br>
<br>
&gt; Sorry I didn&#39;t react, I apparently didn&#39;t get your earlier mail.<br>
<br>
&gt; What do you get if you run pgrep on the command line? (Pgrep is a<br>
&gt; combination of ps and grep. pgrep &lt;name&gt; is the same as ps -A | grep<br>
&gt; &lt;name&gt; where -u ${MYTH_UID} filters on processes owned by ${MYTH_UID})<br>
<br>
&gt; I think your error comes from &quot;$(pgrep -u ${MYTH_UID}<br>
&gt; <a href="http://mythfrontend.re" target="_blank">mythfrontend.re</a>)&quot; giving an unexpected result, most probable because<br>
&gt; the MYTH_UID you have defined in /ect/conf.d/mythfrontend doesn&#39;t<br>
&gt; exist. In my script the user is mythtv, so either you change it to<br>
&gt; another user or if it doesn&#39;t exists create it. Also the user needs a<br>
&gt; correct user directory etc.<br>
<br>
</div></div>Another possibility comes to mind. Did you mistype MYTH_UID in<br>
/ect/conf.d/mythfrontend? If so the variable is empty and it takes<br>
<a href="http://mythfrontend.re" target="_blank">mythfrontend.re</a> as the username and complains about an invalid<br>
username and a missing argument.<br>
<div class=""><div class="h5"><br></div></div></blockquote><div><br></div><div>Thank for the response, Hika.</div><div><br></div><div>pgrep -u mythtv <a href="http://mythfrontend.re">mythfrontend.re</a></div><div><br></div><div>returns no error (I don&#39;t have mythfrontend running at the time, so it returns nothing)</div><div><br></div><div>In conf.d, I have:</div><div><br></div><div><div># User id that all the processes should run as.</div><div>MYTH_UID=&quot;mythtv&quot;</div></div><div><br></div><div>mythtv is a valid user, and the home directory is there.  Also, if the MYTHUID were bad, wouldn&#39;t the init.d script bomb in here?</div><div><br></div><div><div>        start-stop-daemon --start --quiet --background \</div><div>                --user ${MYTH_UID} \</div><div>                --exec /usr/bin/startx \</div><div>                -- -- ${MYTH_XOPTS} vt${MYTH_VT}</div></div><div><br></div><div><br></div></div></div></div>