Files
pistress/bin/plot_cpu_temp.sh
2026-01-24 09:14:36 +01:00

44 lines
718 B
Bash
Executable File

#!/bin/bash
usage() {
local name=${0##*/}
cat <<-EOF
Usage: ${name} [-h || --help] <logfile> <outfile> <title>
Generates graph of the <logfile> and writes it to <outfile>
EOF
}
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
usage
exit 0
fi
# Eingabeparameter
LOGFILE="${1}"
OUTFILE="${2}"
TITLE="${3}"
if [ -z "$LOGFILE" ] || [ -z "$OUTFILE" ] || [ -z "$TITLE" ]; then
usage
exit 1
fi
gnuplot <<EOF
set terminal pngcairo size 1600,900
set output "$OUTFILE"
set title "$TITLE"
set xlabel "Zeit (s)"
set ylabel "Temperatur (°C)"
set grid
set key top left
# Linie rot, Dicke 2
plot "$LOGFILE" using 1:2 with lines lc rgb "red" lw 2 title "CPU-Temperatur"
EOF
echo "Plot erzeugt: $OUTFILE"