CPUSingleTempShutdown.sh & CPUMultiTempShutdown.sh --> mail

Discussion and Technical Support for general software applications and utilities including OS related issues.
Post Reply
danhansen@denmark
Member
Member
Posts: 14
Joined: May 27th, 2013, 3:43 pm

CPUSingleTempShutdown.sh & CPUMultiTempShutdown.sh --> mail

Post by danhansen@denmark »

CPUSingleTempShutdown.sh & CPUMultiTempShutdown.sh --> mail

Here's the problem/answers and communication:
http://forum.havetheknowhow.com/viewtopic.php?f=5&t=820
Here's the script and the "ToDo" which I'm refering to:
http://www.havetheknowhow.com/Configure ... tures.html


Hi Ian,

Hope you are still around or maybe there's another guru who can help me finish this task ;)

This is how far we came:
"...OK, I had to change the whole server park to RACK mounted computers instead. There was no place left here ;)
This is why I haven't posted any feedback other than my last post. I hope you will help me one more time, since it is now time for me to finish my project "CPUSingleTempShutdown.sh" and "CPUMultipleTempShutdown.sh" I will repeat my wish from last time so that you can see what the issues were.."


Issues/Problems:
1.
Regarding the sending of the mail/txt file --> "/usr/sbin/ssmtp myemail@myaddress.com </home/'user'/MyScripts/msg.txt"
In Ubuntu Server 12.04.2 it's "sendmail" which I have to use, is it not? If, please show me the path/or the full code line ;)

2.
What I am trying to do is:
a. to log and mail if "CPU Warning Limit" has exceeded - to log the temp./date etc. into "CPUwarning.Log" and mail it as well! Headline/Subject "CPU TEMP. WARNING" Not just the standard text file but a warning with info about the temp., date etc!
b. to log and mail and shutdown if "CPU Critical Limit" has exceeded - to log the temp./date etc. into "CPUwarning.Log"and mail it as well! Headline/Subject "CPU TEMP. CRITICAL - COMPUTER SHUTDOWN" Not just the standard text file but a warning with info about the temp., date etc. and SHUTDOWN!

This way I am warned by mail if it is running hot before it gets even hotter and shut's down ;)
I will try to make the script myself and post it for you to see, but is it maybe possible, that you could do a suggestion/point me in the right direction?

Last time you wrote:
Just add the email command to the first "if" (the warning "if") and it should work as you want it to. You would need to create a separate "msg.txt" file for the "warning if" and change the text in it to suit.
Good luck and, yes, please send me the script if you get stuck :thumbup:
Ian.

But I was not sure exactly what you meant ;)

3. Do I need to change Ubuntu Server 12.04 shell from "bin/dash" --> "bin/bash"? Is it better? Does it change anything at all?


In short:
1. How do I send the warning mail in Ubuntu Server 12.04 - "/usr/sbin/ssmtp myemail@myaddress.com </home/'user'/MyScripts/msg.txt" doesn't work!!!
2. I need two scripts. One for single CPU/Core and one for multiple CPU's/Core's. Both like "CPUTempShutdown.sh"! But mailing "CPU Temp. Warning!" and the temp. when CPU temp. is "X" degrees and mailing "CPU Temp. Critical!", the temp. and shutdown when CPU temp. is "Y" degrees.
Action: When CPU 1 = X degrees --> log temp., mail temp., echo temp. When CPU 1+ = Y degrees --> log temp., mail temp., echo temp. & shutdown!
3. Shell "bin/dash" needed to be changed to "bin/bash"?


Hoping to hear from you - Thanks in advance ;)

Kind Regards,
Dan Hansen
Denmark
Post Reply