Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dcd6806e72 |
@@ -1,15 +1,36 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
VERSION="1.00"
|
||||||
usage() {
|
usage() {
|
||||||
local name=${0##*/}
|
local name=${0##*/}
|
||||||
|
|
||||||
cat <<-EOF
|
cat <<-EOF
|
||||||
Usage: ${name} [-h || --help] <logfile> <outfile> <title>
|
Version: ${VERSION}
|
||||||
|
Usage: ${name}
|
||||||
|
-h, --help display this help
|
||||||
|
-l, --logfile <logfile> logfile with temperature data to be plotted
|
||||||
|
-o, --output <output.png> output file the plotted chart should be written to
|
||||||
|
-c, --color <colorname> color in which the ghraph should be plotted ('red','blue'dtc.) defaults to 'red'
|
||||||
|
-t, --title <title> title of the graph
|
||||||
|
-v, --verbose verbose mode (not implemented yet)
|
||||||
|
|
||||||
Generates graph of the <logfile> and writes it to <outfile>
|
Plots the graph of the <logfile> and writes it to <outfile>
|
||||||
|
<logfile> must contain
|
||||||
|
timestamp temperature
|
||||||
|
in seperate lines
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check() {
|
||||||
|
if ! command -v gnuplot >/dev/null 2>&1; then
|
||||||
|
echo "gnuplot is not installed."
|
||||||
|
echo "Please use"
|
||||||
|
echo " sudo apt install -y gnuplot"
|
||||||
|
echo "and try again"
|
||||||
|
exit 5
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
verbose=false
|
verbose=false
|
||||||
COLOR='red'
|
COLOR='red'
|
||||||
PADDING=5
|
PADDING=5
|
||||||
@@ -19,10 +40,8 @@ if [[ $? -ne 0 ]]; then
|
|||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "VALID_ARGS=${VALID_ARGS}"
|
|
||||||
eval set -- "$VALID_ARGS"
|
eval set -- "$VALID_ARGS"
|
||||||
while [ : ]; do
|
while [ : ]; do
|
||||||
# echo "aktueller Parameter: ${1}"
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-h | --help)
|
-h | --help)
|
||||||
usage
|
usage
|
||||||
@@ -35,19 +54,15 @@ while [ : ]; do
|
|||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
-o | --output)
|
-o | --output)
|
||||||
echo "1: ${1}, 2:${2},3:${3}"
|
|
||||||
OUTFILE="${2}"
|
OUTFILE="${2}"
|
||||||
echo "OUTFILE=${OUTFILE}"
|
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
-c | --color)
|
-c | --color)
|
||||||
COLOR="${2}"
|
COLOR="${2}"
|
||||||
echo "COLOR=${COLOR}"
|
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
-t | --title)
|
-t | --title)
|
||||||
TITLE="${2}"
|
TITLE="${2}"
|
||||||
echo "TITLE=${TITLE}"
|
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
-v | --verbose)
|
-v | --verbose)
|
||||||
@@ -59,7 +74,7 @@ while [ : ]; do
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
check
|
||||||
#determine max and min values
|
#determine max and min values
|
||||||
read YMIN YMAX < <(
|
read YMIN YMAX < <(
|
||||||
awk '
|
awk '
|
||||||
|
|||||||
Reference in New Issue
Block a user