[ale] [OT] how do I monitor the "weather" in my computer room

Jim Kinney jim.kinney at gmail.com
Thu Jun 6 23:57:25 EDT 2013


Use of a filename extension to indicate file type
 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.


On Thu, Jun 6, 2013 at 11:38 PM, Ron Frazier (ALE) <
atllinuxenthinfo at techstarship.com> wrote:

> Hi Scott, Alex, and all,
>
> 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.
>
> 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.
>
> -----------------
>
> checktemps file
>
> #!/bin/bash
> cd ~
>
> echo '<html>' > temperature.html
>
>
> echo 'Bugs01 Temperatures' >> temperature.html
> echo '<p>' >> temperature.html
>
> date >> temperature.html
> echo '<p>' >> temperature.html
>
> echo 'CPU - ' >> temperature.html
> sensors | grep 'temp1' >> temperature.html
> echo '<p>' >> temperature.html
>
> echo 'HDD1 - ' >> temperature.html
> sudo -S hddtemp /dev/sda < pw.txt >> temperature.html
> echo '<p>' >> temperature.html
>
> echo 'HDD2 - ' >> temperature.html
> sudo -S hddtemp /dev/sdb < pw.txt >> temperature.html
> echo '<p>' >> temperature.html
>
> echo 'GPU0 - ' >> temperature.html
> sudo aticonfig --adapter=0 --odgt >> temperature.html
> echo '<p>' >> temperature.html
>
> echo 'GPU1 - ' >> temperature.html
> sudo aticonfig --adapter=1 --odgt >> temperature.html
> echo '<p>' >> temperature.html
>
> echo 'GPU2 - ' >> temperature.html
> sudo aticonfig --adapter=2 --odgt >> temperature.html
> echo '<p>' >> temperature.html
>
>
> echo '</html>' >> temperature.html
>
> ----------------
>
> By the way, even though scripts run without an extension in the file name,
> is it normal to use an extension?
>
> I then execute the checktemps script every 15 seconds with:
>
> watch -n 15 ./checktemps
>
> 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:
>
> while true; do sudo nc -l 56789 < ./temperature.html; done
>
> I enter the following address of my basement computer in a web browser on
> the same subnet:
>
> http://192.168.81.134:56789/
>
> I get the following:
>
> ---------------------
>
> browser result on special port
>
> <html>
> Bugs01 Temperatures
> <p>
> Thu Jun 6 22:57:36 EDT 2013
> <p>
> CPU -
> temp1: +43.0°C (high = +70.0°C)
> <p>
> HDD1 -
> /dev/sda: ST9320320AS: 25°C
> <p>
> HDD2 -
> /dev/sdb: ST95005620AS: 27°C
> <p>
> GPU0 -
>
> Adapter 0 - AMD Radeon HD 7800 Series
> Sensor 0: Temperature - 82.00 C
> <p>
> GPU1 -
>
>
> Adapter 1 - AMD Radeon HD 6700 Series
> Sensor 0: Temperature - 79.00 C
> <p>
> GPU2 -
>
> Adapter 2 - AMD Radeon HD 7800 Series
> Sensor 0: Temperature - 70.00 C
> <p>
> </html>
>
> -----------------
>
> 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:
>
> browser result on port 80
>
> Bugs01 Temperatures
>
> Thu Jun 6 23:18:55 EDT 2013
>
> CPU - temp1: +43.0°C (high = +70.0°C)
>
> HDD1 - /dev/sda: ST9320320AS: 25°C
>
> HDD2 - /dev/sdb: ST95005620AS: 28°C
>
> GPU0 - Adapter 0 - AMD Radeon HD 7800 Series Sensor 0: Temperature - 81.00
> C
>
> GPU1 - Adapter 1 - AMD Radeon HD 6700 Series Sensor 0: Temperature - 81.00
> C
>
> GPU2 - Adapter 2 - AMD Radeon HD 7800 Series Sensor 0: Temperature - 71.00
> C
>
> --------------------
>
> So, I'm getting there.  There are still a few problems though:
>
> 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.
>
> B) The sudo authorization for the nc command expires and then my web page
> no longer loads.
>
> C) I don't have an autostart sequence running yet.
>
> D) Sometimes, if I happen to retrieve the file while it's being written, I
> get an incomplete result.
>
> E) I cannot CTRL-C to terminate the window with the nc running in it.  I
> have to force close that window.
>
> Anyway, like I said, getting there.
>
> Any further suggestions are appreciated.
>
> Sincerely,
>
> Ron
>
>
>
> --
>
> (PS - If you email me and don't get a quick response, you might want to
> call on the phone.  I get about 300 emails per day from alternate energy
> mailing lists and such.  I don't always see new email messages very
> quickly.)
>
> Ron Frazier
> 770-205-9422 (O)   Leave a message.
> linuxdude AT techstarship.com
> Litecoin: LZzAJu9rZEWzALxDhAHnWLRvybVAVg**wTh3
> Bitcoin: 15s3aLVsxm8EuQvT8gUDw3RWqvuY9h**PGUU
>
> ______________________________**_________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/**listinfo/ale<http://mail.ale.org/mailman/listinfo/ale>
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/**listinfo<http://mail.ale.org/mailman/listinfo>
>



-- 
-- 
James P. Kinney III
*
*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.
- Speech 11/23/1900 Mark Twain
*
http://electjimkinney.org
http://heretothereideas.blogspot.com/
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20130606/a1d95707/attachment.html>


More information about the Ale mailing list