<div dir="ltr"><div>Use of a filename extension to indicate file type<br></div> benefits the user by making it easy to the intended file. Is it "wrong" to have a bash script with no ".sh"? No. But having it makes it clearer what it is without having to read the file.<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jun 6, 2013 at 11:38 PM, Ron Frazier (ALE) <span dir="ltr"><<a href="mailto:atllinuxenthinfo@techstarship.com" target="_blank">atllinuxenthinfo@techstarship.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Scott, Alex, and all,<br>
<br>
Thanks for the recent suggestions. I now have a crude and rude, quick and dirty, and somewhat ugly solution running. But ... it is running, which is very cool. Anyone is welcome to use these scripts.<br>
<br>
I first created a script to read the sensors and create a simple crude html data file. I didn't worry with tables. I just use raw text and paragraph markers. The hddtemp command must run as sudo, and pulls its password from a text file. I don't know if that's the best way to handle it or not, but it works.<br>
<br>
-----------------<br>
<br>
checktemps file<br>
<br>
#!/bin/bash<br>
cd ~<br>
<br>
echo '<html>' > temperature.html<br>
<br>
<br>
echo 'Bugs01 Temperatures' >> temperature.html<br>
echo '<p>' >> temperature.html<br>
<br>
date >> temperature.html<br>
echo '<p>' >> temperature.html<br>
<br>
echo 'CPU - ' >> temperature.html<br>
sensors | grep 'temp1' >> temperature.html<br>
echo '<p>' >> temperature.html<br>
<br>
echo 'HDD1 - ' >> temperature.html<br>
sudo -S hddtemp /dev/sda < pw.txt >> temperature.html<br>
echo '<p>' >> temperature.html<br>
<br>
echo 'HDD2 - ' >> temperature.html<br>
sudo -S hddtemp /dev/sdb < pw.txt >> temperature.html<br>
echo '<p>' >> temperature.html<br>
<br>
echo 'GPU0 - ' >> temperature.html<br>
sudo aticonfig --adapter=0 --odgt >> temperature.html<br>
echo '<p>' >> temperature.html<br>
<br>
echo 'GPU1 - ' >> temperature.html<br>
sudo aticonfig --adapter=1 --odgt >> temperature.html<br>
echo '<p>' >> temperature.html<br>
<br>
echo 'GPU2 - ' >> temperature.html<br>
sudo aticonfig --adapter=2 --odgt >> temperature.html<br>
echo '<p>' >> temperature.html<br>
<br>
<br>
echo '</html>' >> temperature.html<br>
<br>
----------------<br>
<br>
By the way, even though scripts run without an extension in the file name, is it normal to use an extension?<br>
<br>
I then execute the checktemps script every 15 seconds with:<br>
<br>
watch -n 15 ./checktemps<br>
<br>
Then I use the nc command (starting it by hand) to serve up the data file when requested on a port number other than the default. This must also run as sudo:<br>
<br>
while true; do sudo nc -l 56789 < ./temperature.html; done<br>
<br>
I enter the following address of my basement computer in a web browser on the same subnet:<br>
<br>
<a href="http://192.168.81.134:56789/" target="_blank">http://192.168.81.134:56789/</a><br>
<br>
I get the following:<br>
<br>
---------------------<br>
<br>
browser result on special port<br>
<br>
<html><br>
Bugs01 Temperatures<br>
<p><br>
Thu Jun 6 22:57:36 EDT 2013<br>
<p><br>
CPU -<br>
temp1: +43.0°C (high = +70.0°C)<br>
<p><br>
HDD1 -<br>
/dev/sda: ST9320320AS: 25°C<br>
<p><br>
HDD2 -<br>
/dev/sdb: ST95005620AS: 27°C<br>
<p><br>
GPU0 -<br>
<br>
Adapter 0 - AMD Radeon HD 7800 Series<br>
Sensor 0: Temperature - 82.00 C<br>
<p><br>
GPU1 -<div class="im"><br>
<br>
Adapter 1 - AMD Radeon HD 6700 Series<br></div>
Sensor 0: Temperature - 79.00 C<br>
<p><br>
GPU2 -<br>
<br>
Adapter 2 - AMD Radeon HD 7800 Series<br>
Sensor 0: Temperature - 70.00 C<br>
<p><br>
</html><br>
<br>
-----------------<br>
<br>
So, it works. What's weird is that it's actually showing the source text of the html file. However, if I do the same thing on port 80, it actually formats as a web page and looks like this:<br>
<br>
browser result on port 80<br>
<br>
Bugs01 Temperatures<br>
<br>
Thu Jun 6 23:18:55 EDT 2013<br>
<br>
CPU - temp1: +43.0°C (high = +70.0°C)<br>
<br>
HDD1 - /dev/sda: ST9320320AS: 25°C<br>
<br>
HDD2 - /dev/sdb: ST95005620AS: 28°C<br>
<br>
GPU0 - Adapter 0 - AMD Radeon HD 7800 Series Sensor 0: Temperature - 81.00 C<br>
<br>
GPU1 - Adapter 1 - AMD Radeon HD 6700 Series Sensor 0: Temperature - 81.00 C<br>
<br>
GPU2 - Adapter 2 - AMD Radeon HD 7800 Series Sensor 0: Temperature - 71.00 C<br>
<br>
--------------------<br>
<br>
So, I'm getting there. There are still a few problems though:<br>
<br>
A) If I let nc run on port 80, I get a properly displayed web page in the browser. If I don't, I get a display as if I'm looking at the page source.<br>
<br>
B) The sudo authorization for the nc command expires and then my web page no longer loads.<br>
<br>
C) I don't have an autostart sequence running yet.<br>
<br>
D) Sometimes, if I happen to retrieve the file while it's being written, I get an incomplete result.<br>
<br>
E) I cannot CTRL-C to terminate the window with the nc running in it. I have to force close that window.<br>
<br>
Anyway, like I said, getting there.<br>
<br>
Any further suggestions are appreciated.<br>
<br>
Sincerely,<br>
<br>
Ron<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
-- <br>
<br>
(PS - If you email me and don't get a quick response, you might want to<br>
call on the phone. I get about 300 emails per day from alternate energy<br>
mailing lists and such. I don't always see new email messages very quickly.)<br>
<br>
Ron Frazier<br>
<a href="tel:770-205-9422" value="+17702059422" target="_blank">770-205-9422</a> (O) Leave a message.<br>
linuxdude AT <a href="http://techstarship.com" target="_blank">techstarship.com</a><br>
Litecoin: LZzAJu9rZEWzALxDhAHnWLRvybVAVg<u></u>wTh3<br>
Bitcoin: 15s3aLVsxm8EuQvT8gUDw3RWqvuY9h<u></u>PGUU<br>
<br>
______________________________<u></u>_________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org" target="_blank">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/<u></u>listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/<u></u>listinfo</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>-- <br>James P. Kinney III<br><i><i><i><i><br></i></i></i></i>Every time you stop a school, you will have to build a jail. What you
gain at one end you lose at the other. It's like feeding a dog on his
own tail. It won't fatten the dog.<br>
- Speech 11/23/1900 Mark Twain<br><i><i><i><i><br><a href="http://electjimkinney.org" target="_blank">http://electjimkinney.org</a><br><a href="http://heretothereideas.blogspot.com/" target="_blank">http://heretothereideas.blogspot.com/</a><br>
</i></i></i></i>
</div>