<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p><br>
</p>
<p> </p>
<p style="margin-bottom: 0in; line-height: 100%">Hi Folks!</p>
<p style="margin-bottom: 0in; line-height: 100%"><br>
</p>
<p style="margin-bottom: 0in; line-height: 100%">Trying to create a
script to let me know when my MythTV Backend is not running. What
I
have works, but apparently only if totally off-line (as in off).
This morning not quite sure what happened but the Frontend could
not
find the Backend (glanced at the screen, knew it was a BE issue).
Accessing the webpage (Firefox to 192.168.4.3:6544) the “last 10”
rotating display was not present, fairly certain the ‘Current
Tuner
Activity” listing was present; ‘Frontend Status” was definitely
present. (Probably unnecessary information, but in case help….)</p>
<p style="margin-bottom: 0in; line-height: 100%"><br>
</p>
<p style="margin-bottom: 0in; line-height: 100%">What I current have
follows; cron on the computer my rump is usually in front of has a
script which inquires the Backend every 15 minutes during the day.
If no problem no notification; if there is a problem a popup
appears
on my screen. Works if the MythTV is totally off, but did not
notify
with the above situation. I also prefer the pop-up over an e-mail
notification.</p>
<p style="margin-bottom: 0in; line-height: 100%"><br>
</p>
<p style="margin-bottom: 0in; line-height: 100%">The nitty-grity so
far:</p>
<p style="margin-bottom: 0in; line-height: 100%"><br>
</p>
<p style="margin-bottom: 0in; line-height: 100%">The Backend is at
192.168.4.3.</p>
<p style="margin-bottom: 0in; line-height: 100%"><br>
</p>
<p style="margin-bottom: 0in; line-height: 100%">crontab on my
computer:</p>
<p style="margin-bottom: 0in; line-height: 100%"><br>
</p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#dddddd">
<font face="Liberation Mono, monospace"><font style="font-size:
10pt" size="2">#
Test Backend 3 (BE3) is on-line every 15 minutes from 6:00
a.m. to
7:45 p.m.</font></font></p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#dddddd">
<font face="Liberation Mono, monospace"><font style="font-size:
10pt" size="2">#
The script does not display except with a problem</font></font></p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#dddddd">
<font face="Liberation Mono, monospace"><font style="font-size:
10pt" size="2">*/15 07-19 * * * export DISPLAY=:0 &&
/bin/sh '/home/barry/MythTV Backend Scripts/Test_BE3.sh' </font></font>
</p>
<p style="margin-bottom: 0in; line-height: 100%"><br>
</p>
<p style="margin-bottom: 0in; line-height: 100%">==>
barry@NZXT:~$ cat '/home/barry/MythTV Backend Scripts/Test_BE3.sh'
</p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee">
<font face="Liberation Mono, monospace"><font style="font-size:
10pt" size="2">#!/bin/sh</font></font></p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee">
<br>
</p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee">
<font face="Liberation Mono, monospace"><font style="font-size:
10pt" size="2">#
Test Backend 3 (BE3) 192.168.4.3</font></font></p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee">
<font face="Liberation Mono, monospace"><font style="font-size:
10pt" size="2">#
</font></font>
</p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee">
<font face="Liberation Mono, monospace"><font style="font-size:
10pt" size="2">#
Test cmd line for make appear off-line: search for " nc -z "</font></font></p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee">
<font face="Liberation Mono, monospace"><font style="font-size:
10pt" size="2">#</font></font></p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee">
<font face="Liberation Mono, monospace"><font style="font-size:
10pt" size="2">#####################################################################</font></font></p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee">
<font face="Liberation Mono, monospace"><font style="font-size:
10pt" size="2">#
Create variables</font></font></p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee">
<font face="Liberation Mono, monospace"><font style="font-size:
10pt" size="2">current_date_time=$(date)</font></font></p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee">
<br>
</p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee">
<font face="Liberation Mono, monospace"><font style="font-size:
10pt" size="2">#####################################################################</font></font></p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee">
<font face="Liberation Mono, monospace"><font style="font-size:
10pt" size="2">#
Test connection -- port 6544 is default -- use 8080 for
off-line test</font></font></p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee">
<font face="Liberation Mono, monospace"><font style="font-size:
10pt" size="2">nc
-z 192.168.4.3 6544</font></font></p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee">
<font face="Liberation Mono, monospace"><font style="font-size:
10pt" size="2">if
[ $? -eq 0 ]</font></font></p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee">
<font face="Liberation Mono, monospace"><font style="font-size:
10pt" size="2">then</font></font></p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee"> <font face="Liberation Mono, monospace"><font
style="font-size: 10pt" size="2">echo
"BE3 is up."</font></font></p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee">
<font face="Liberation Mono, monospace"><font style="font-size:
10pt" size="2">else</font></font></p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee"> <font face="Liberation Mono, monospace"><font
style="font-size: 10pt" size="2">echo
"exit status is $?."</font></font></p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee"> <font face="Liberation Mono, monospace"><font
style="font-size: 10pt" size="2">echo
"BE3 192.168.4.3:6544 down."</font></font></p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee"> <font face="Liberation Mono, monospace"><font
style="font-size: 10pt" size="2">Err_BE3_1="Oh-oh!!
MythTV Backend 3 (BE3 - 192.168.4.3) is down! "</font></font></p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee">
<font face="Liberation Mono, monospace"><font style="font-size:
10pt" size="2"># XMsg_Size=" -fn
'-*-*-*-r-*--0-150-0-0-p-*-iso8859-1'"</font></font></p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee">
<font face="Liberation Mono, monospace"><font style="font-size:
10pt" size="2">#
Why this works in one script and not another -- bug</font></font></p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee">
<font face="Liberation Mono, monospace"><font style="font-size:
10pt" size="2"># XMsg_Size=" -fn
'-*-*-*-r-*--0-200-0-0-p-*-iso8859-1'"</font></font></p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee">
<font face="Liberation Mono, monospace"><font style="font-size:
10pt" size="2"># echo "$current_date_time\n $Err_BE3_1\n" |
xmessage
$XMsg_Size -file -</font></font></p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee"> <font face="Liberation Mono, monospace"><font
style="font-size: 10pt" size="2">echo
"$current_date_time\n $Err_BE3_1\n" | xmessage -fn
'-*-*-*-r-*--0-200-0-0-p-*-iso8859-1' -file -</font></font></p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee">
<br>
</p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee">
<font face="Liberation Mono, monospace"><font style="font-size:
10pt" size="2">fi</font></font></p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee">
<br>
</p>
<p style="margin-bottom: 0in; line-height: 100%; background:
#eeeeee">
<font face="Liberation Mono, monospace"><font style="font-size:
10pt" size="2">exit</font></font></p>
<p style="margin-bottom: 0in; line-height: 100%"><br>
</p>
<p style="margin-bottom: 0in; line-height: 100%"><br>
</p>
<p style="margin-bottom: 0in; line-height: 100%">I don’t know what
netcat’s -z switch does – saw it when cookbooking another project
and seemed to do what I needed. ..Something about not sending data
(which is probably good as I saw something about a lot of pings
could
lock up MythTV).</p>
<p style="margin-bottom: 0in; line-height: 100%"><br>
</p>
<p style="margin-bottom: 0in; line-height: 100%">Thanks!</p>
<p style="margin-bottom: 0in; line-height: 100%">Barry </p>
<p>
<style type="text/css">p { margin-bottom: 0.1in; line-height: 115% }</style></p>
<p><br>
</p>
<p><br>
</p>
</body>
</html>