You are not logged in.
Hi.
I am trying to create a script that gathers thermal information from my various sensors on my server, and sends it to me via mail once per day. I have managed to generate the content, but I need help with some polishing.
temp.sh
#!/bin/bash
sensors | grep temp && aticonfig --odgt --adapter=0 && aticonfig --odgt --adapter=1
tempmon.sh
#!/bin/bash
echo “Current Temperature Is: $(/home/user/bin/temp.sh)” | mail -s “Thermal_Status” mail@example.com
The output I receive in my mail is this:
“Current Temperature Is: k10temp-pci-00c3 temp1: +32.5°C (high = +70.0°C) temp1: +42.0°C (low = +127.0°C, high = +127.0°C) sensor = thermistor temp2: +35.0°C (low = +127.0°C, high = +127.0°C) sensor = thermal diode temp3: +78.0°C (low = +127.0°C, high = +127.0°C) sensor = thermistor Adapter 0 - AMD Radeon HD 6800 Series Sensor 0: Temperature - 72.00 C Default Adapter - AMD Radeon HD 6800 Series Sensor 0: Temperature - 72.00 C”
I have 2 questions:
1. How can I specify the first script to omit the "k10temp-pci-00c3"-part?
2. How can I generate more readable text? This is all sent to me as one long line of text. However, if I issue the temp.sh in a ssh terminal the information is presented with new lines after every sensor, and distance between the values, making it a lot more readable.
Thank you in advance.
Offline
Why not store the output in variable and call it at will. Example:
#!/bin/bash
mb=`sensors | grep "Mobo" | cut -c16-17`
cpu=`sensors | grep "CPU0 Temp" | cut -c16-17`
hdd=`sudo hddtemp /dev/sda | cut -c34-35`
gpu=`nvidia-smi -q -d TEMPERATURE|grep Gpu|cut -c35-36`
mhz=`cat /proc/cpuinfo | grep MHz | cut -c12-19`
echo
echo CPU: $cpu °C @ $mhz MHz
echo GPU: $gpu °C
echo M/B: $mb °C
echo HDD: $hdd °C
$ temps
CPU: 47 °C @ 1733.546 MHz
GPU: 53 °C
M/B: 34 °C
HDD: 37 °C
Something more graphically rich (although this isn't what you asked for) if monitorix. PKGBUILD in AUR.
Last edited by graysky (2011-06-11 22:09:02)
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
Thank you Graysky. As usual, you pointed me in the right direction.
Will also check out to see what monitorix is.
Cheers.
Offline
You're welcome. Love your avatar - Deadwood was once of HBO's best series.
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
You're welcome. Love your avatar - Deadwood was once of HBO's best series.
Totally, I still enjoy watching it through once every year.
Offline