понедельник, 30 января 2017 г.

gnuplot температура CPU

#!/bin/bash

FILE="/tmp/sys_temp_gnuplot_h"
echo " проверка файла..."
if [ -f $FILE ]; then
echo " файл найден..." # файл есть
MAX=(62)
TMP=`cat /tmp/sys_temp_gnuplot_h | wc -l`
echo " $TMP"
if [ $TMP -ge $MAX ]; then
echo " файл 62 и более строк!" # в файле 23 и более строк
truncate -s 0 /tmp/sys_temp_gnuplot_h
echo "`date +%d-%m` `date +%H:%M` `/usr/bin/sensors | grep -E 'Physical id 0*' | awk {'print $4'} | cut -c 2-3`" >> /tmp/sys_temp_gnuplot_h
# # # # # # # # # # #
gnuplot << EOP

datafile = "/tmp/sys_temp_gnuplot_h"
set terminal jpeg font arial 14 size 1600,1200
set output "/var/www/html/sys_temp_cpu_h.jpg"
set tics out scale 0.5
set ytics 1.0 border rangelimited mirror
set y2tics 1.0 border nomirror
set border 3
set xrange [:]
set yrange [34:70]
set ylabel "Температура (C)"
set timefmt "%d-%m %H:%M"
set xdata time
set style line 1 lc rgb 'red' lt 2 lw 2
set style data histogram
set style histogram cluster gap 1
set style fill pattern border -1
set xtics rotate by 0 rangelimited 1*300
set mxtics 3 #a small tic every five minute
set format x "%d-%m\n%H:%M" #set format x was needed to format the x axis as hh:mm, not hh:mm:ss
set grid x y y2 layerdefault linecolor rgb "gray" linewidth 4.0 dashtype solid, linecolor rgb "gray" linewidth 4.0 dashtype "."
set title "Температура(C) CPU Час" font "Times-Roman,35"
plot datafile using 1:3 title 'Температура CPU' with lines lw 4 lt rgb "red"

EOP
# # # # # # # # # # #
else
echo " файл менее 62 строк" # в файле менее 23 строк
echo "`date +%d-%m` `date +%H:%M` `/usr/bin/sensors | grep -E 'Physical id 0*' | awk {'print $4'} | cut -c 2-3`" >> /tmp/sys_temp_gnuplot_h
FILE1="/tmp/sys_temp_gnuplot_h"
echo " проверка файла..."
if [ -f $FILE1 ]; then
# файл есть
MAX=(61)
TMP1=`cat /tmp/sys_temp_gnuplot_h | wc -l`
echo " $TMP1"
if [ $TMP -ge $MAX ]; then
# более 60
echo " удаляется 1-я строчка..."
sed -i '1d' /tmp/sys_temp_gnuplot_h
fi
fi

# # # # # # # # # # #
gnuplot << EOP

datafile = "/tmp/sys_temp_gnuplot_h"
set terminal jpeg font arial 14 size 1600,1200
set output "/var/www/html/sys_temp_cpu_h.jpg"
set tics out scale 0.5
set ytics 1.0 border rangelimited mirror
set y2tics 1.0 border nomirror
set border 3
set xrange [:]
set yrange [34:70]
set ylabel "Температура (C)"
set timefmt "%d-%m %H:%M"
set xdata time
set style line 1 lc rgb 'red' lt 2 lw 2
set style data histogram
set style histogram cluster gap 1
set style fill pattern border -1
set xtics rotate by 0 rangelimited 1*300 # 1*3600
set mxtics 3 #a small tic every five minute
set format x "%d-%m\n%H:%M" #set format x was needed to format the x axis as hh:mm, not hh:mm:ss
set grid x y y2 layerdefault linecolor rgb "gray" linewidth 4.0 dashtype solid, linecolor rgb "gray" linewidth 4.0 dashtype "."
set title "Температура(C) CPU Час" font "Times-Roman,35"
plot datafile using 1:3 title 'Температура CPU' with lines lw 4 lt rgb "red"

EOP
# # # # # # #
fi
else
echo " файл не найден!!!" # файла нет
echo "`date +%d-%m` `date +%H:%M` `/usr/bin/sensors | grep -E 'Physical id 0*' | awk {'print $4'} | cut -c 2-3`" >> /tmp/sys_temp_gnuplot_h
# # # # # # # # # # #
gnuplot << EOP

datafile = "/tmp/sys_temp_gnuplot_h"
set terminal jpeg font arial 14 size 1600,1200
set output "/var/www/html/sys_temp_cpu_h.jpg"
set tics out scale 0.5
set ytics 1.0 border rangelimited mirror
set y2tics 1.0 border nomirror
set border 3
set xrange [:]
set yrange [34:70]
set ylabel "Температура (C)"
set timefmt "%d-%m %H:%M"
set xdata time
set style line 1 lc rgb 'red' lt 2 lw 2
set style data histogram
set style histogram cluster gap 1
set style fill pattern border -1
set xtics rotate by 0 rangelimited 1*300
set mxtics 3 #a small tic every five minute
set format x "%d-%m\n%H:%M" #set format x was needed to format the x axis as hh:mm, not hh:mm:ss
set grid x y y2 layerdefault linecolor rgb "gray" linewidth 4.0 dashtype solid, linecolor rgb "gray" linewidth 4.0 dashtype "."
set title "Температура(C) CPU Час" font "Times-Roman,35"
plot datafile using 1:3 title 'Температура CPU' with lines lw 4 lt rgb "red"

EOP
# # # # # # #
fi

Комментариев нет:

Отправить комментарий

h265.sh

#!/bin/bash file="../mp4" if [ -d $file ]; then         echo "  Директория существует :-) "         for i in *.mp4; do f...