Linux Blog

APC Access Temperature Query and Conversion. (2 of 2)

Filed under: Shell Script Sundays — TheLinuxBlog.com at 6:55 pm on Sunday, March 29, 2009

This second part of the script APC Access Temperature Query Script and its been a long time coming. Basically this script is the part that runs as a cron and will e-mail me if the temperature goes over a certain threshold. Once it returns to normal it e-mails me again. It has the option to send a text message to me via my SMS gateway, but it is commented out.

#!/bin/bash
 
temp=$(/home/linux/bin/temp f)
threshold=76
 
if [ "`echo \"$temp > $threshold\" | bc`" == 1 ]; then
echo $(date +%s) $temp >> /home/linux/thermal-over.log
echo "High Temp";
 
if [ "$(cat temp.txt)" == "norm" ]; then
echo "Sending E-Mail, High Temp";
echo "Current Temperature Is: $(/home/linux/bin/temp f)" | mail -s "Thermal Overload" owen@linuxblog                #echo "Current Temp Is: $(/home/linux/bin/temp f)" | mail -s "Thermal Overload" mynumber@cingularme.com
echo "high" > temp.txt
fi
elif [ "`echo \"$temp < $threshold\" | bc`" == 1 ]; then
echo "Low Temp";
 
if [ "$(cat temp.txt)" == "high" ]; then
echo "Temp Resumed, Sending E-Mail";
echo $(date +%s) Resumed at: $temp | mail -s "Thermal Normal" owen@linuxblog
echo "norm" > temp.txt
fi
 
fi
 
echo $(date +%s) $temp >> /home/linux/thermal.log

When I first wrote the script, I did not do any temperature checking. I found out that I needed to when I came back one morning with a bunch of emails that I needed to delete. Its pretty simple to figure out, temp.txt holds a value that is either norm or high. It gets switched when the temperature changes, this will in turn stop it from e-mailing me repeatedly. Once the temperature drops it flips it back. It will still e-mail if your temperature fluctuates between 75 and 77 which can be annoying, but you can adjust the threshold with the variable and set it to what you need. Thankfully our chiller has been fixed and I no longer have to worry about the temperature, but it still runs on a cron just in case.

Throw a rave when you work too hard

Filed under: Linux Software — TheLinuxBlog.com at 7:36 pm on Wednesday, December 3, 2008

Workrave

Workrave is an awesome little utility that I just found out about almost a week ago now. Basically what it does is sits in your tray and bugs you when you should take breaks. Its really simple to use, and is in the Fedora repositories. Since, my Open SUSE laptop is at home and off, I can’t tell you if it is in there but my guess is that Debian / Ubuntu also have this package. Once you’ve got it installed by whatever means possible, run it. Its very easy to use, but I would advise setting up your defaults. If you don’t you’ll be taking a short rest break once every 3 minutes, which I find to be a bit excessive. You also get rest breaks, which advise you to stand up and walk around, and do stretches. It has some great statistics such as how many keystrokes you make, how many breaks you’ve taken. It also accounts for “natural” rest breaks, so if there is no activity on your computer, it thinks you are idle. Although I have not tried it there is network support for Workrave. Perhaps one day I will try it. If you spend a long time in front of the computer at home or work (like I’m doing today) then this may be the application for you, especially if you are trying to avoid doing work. getting fatigued. Talking of work, I had better get back to what I was doing; oh yea, taking a break.

The Economy and Open Source

Filed under: General Linux — TheLinuxBlog.com at 11:53 am on Monday, October 6, 2008

The word on the street, at least all over the news is that we could be heading into bad times. All over the news sites are articles on how Open Source will or could save you money. For individuals that know about GNU/Linux, it is not a question that if you are building a new PC and you run Linux, you are going to save $100 from not having to buy an operating system. Often there are comparable applications that may be used as alternatives and a little more money could be saved. Many argue that time is money, you get your licenses when you buy a new PC, etc. I don’t know the exact answer, it’s hard to say for each individual case but I have not spent any money on software in a long time.

I don’t know if Open Source will gain more momentum because of the economy and I don’t think that any one knows for sure. All that can be done is speculate and correlate data.

Here are some Links to other articles on this topic for those that are interested:
Open Source To The Rescue In Hard Times
http://www.informationweek.com/blog/main/archives/2008/10/open_source_to.html

Linux and FOSS in a Slowing Economy
http://www.linuxjournal.com/content/linux-and-foss-slowing-economy

Switch! The Linux Blog Dog

Filed under: The Linux Blog News — TheLinuxBlog.com at 10:57 am on Friday, June 20, 2008

So, after a long time with no posts I think I figured out why I haven’t been writing as much. You see, I recently got a dog, she is a 7 month old border collie – whippet mix. Her name is switch and she currently demands a lot of attention or she gets into mischief, but after a long walk she does a really wicked FireFox impression which makes up for it.

I’ll be writing as much as I can, but again if any one would like to write on this blog or is interested in guest blogging just let me know.

Below are some pictures of Switch! The Linux Blog Dog

Linux Blog Dog
Linux Blog Dog

Become independent of the system tray using conky.

Filed under: General Linux,The Linux Blog News — Kaleb at 9:19 pm on Thursday, February 7, 2008

Hello everybody it is I Kaleb from over at http://kpstuff.servebeer.com again come to talk today about an app that I have been using for a while but just recently decided to make it fix my dependence of the system tray all together.

If you read my blog regularly you would know that I am not a fan of GUI applications, I use as few of them as possible. I prefer to use command line programs instead for many reasons: one they are faster, two they are easier and quicker to use/access the features that I want from them, and three I just like the way they look.

For a long time I have used the Fluxbox window manager because it is small lightweight and over all pretty. But no matter what window manager I use: Gnome, KDE, Xfce, FluxBox or OpenBox I have always had some dependence on the system tray, which annoyed me a lot.

Some of them things that I liked a system tray for were a static clock that was always in the same spot and I could always look down and see it, also it had a few nice little icons over there for me to use at my will, like for instance, Gmail-Notify which is a little systray applet that will tell you if you have gmail or not and give you a little pop-up if you get new mail. Also this was for a while how i was telling if I had a new message in pidgin.

Then I started thinking to myself,

“All of these things could be done with Conky and I could use Conky for even more.”

So began the transformation.

If you don’t know already what Conky is, it is a little application that will put text in any format and of almost any type of data you want, weather it be the weather report for the day or the week, or your battery status, the day of the week, or your wireless link quality. It blends into your desktop very well and will give you that sweet geekish look that everybody looks for in a desktop.

First we need to install it.

Gentoo:

emerge -av conky

Make sure that you check out the use flags in Gentoo for things like “wifi” and others

Arch Linux:

pacman -S conky

Ubuntu:

apt-get install conky

Now that you have Conky installed it is time for you to figure out where on your screen you want to put it and also how you want it to look. I wont get into to much detail about how to set it up because those things can be figured out by the most green of Linux users. Also there should be an example config file for Conky that came with the install for Gentoo it is /etc/conky/conky.conf. You need to copy this file to ~/.conkyrc and then edit it at your leisure.

It is quite simple to figure out first you decided the main variables for the program then after the word TEXT you decide how your Conky will look on your desktop. What “text” you would like to see and in what fashion. It is here where you will replace your systray.The first thing I wanted my replacement system tray to display was my gmail messages, weather I had emails or not and how many. So I put together a little script that you can obtain from http://kpstuff.servebeer.com/~admin/check_gmail.sh in order to use this script you need to download it. I suggest to put it into a folder such as ~/scripts/ also make it executable with either “chmod 755 check_gmail.sh” or “chmod +x check_gmail.sh” and remember to edit check_gmail.sh for your username and password. Then you need to edit your ~/.conkyrc file under the TEXT area to resemble this

${texeci 60 ~/scripts/check_gmail.sh}

After this I wanted a clock obviously. Now the time variable has almost a million different options for the format that it gives so I will give you an example of how to set it up but you should run “man strftime” to see a full list of formatting options.

${time %I:%M%p}

This will put a time format on your Conky that resembles “02:19PM”

Yes that is right it is that easy and you can almost print anything you want on Conky even RSS feeds, I suggest you try it out at least once, but not just a little install it and run it and it doesn’t work try.

There are literally hundreds of variables that can be used in Conky and those that are not variables can be created using shell/perl/php/and ruby scripts.

For a list of variables go to http://conky.sourceforge.net/config_settings.html and http://conky.sourceforge.net/variables.html

Thank you once more for your time and remember to leave comments for any of the writers for the Linux blog because each of us would sure appreciate feedback on our writings, whether it be good or bad.

Linux Blog new year roundup

Filed under: The Linux Blog News — TheLinuxBlog.com at 10:16 pm on Monday, December 31, 2007

I’d just like to say I’ve been busy over the past week or two with some projects at work and with the holiday season so I haven’t had the time to dedicated to this blog.

Its been a good year at the Linux Blog, I’ve increased traffic since I’ve started and have been beginning to see more activity with comments. I have a couple of goals for the upcoming year.

Firstly I’d like to make some money with Google ads. This isn’t specifically related to the Linux Blog but every little counts. I want to do this because I think that this site has some value to those that use it and I would like to be rewarded for my hard work.

Another goal I have is to write more posts than I did this year. It shouldn’t be hard to do since I stopped writing for a long time in 2007. From about Jan to July. I have a long list of posts to write but I need to know what topics people want to read about.

I have a list of articles to write for the Shell Scripting Sundays column but haven’t got enough ideas for the year yet. I may be able to get a few more if I split some of the more intense ones up but I’d rather keep them simple. If any one has any ideas for articles please let me know.

Thats going to be all for this year, I hope you enjoyed reading my blog and continue to visit me in the new year. For those that do

Happy New Year!