DD2-monitor/exemple.sh

34 lines
488 B
Bash
Raw Normal View History

2018-12-05 16:30:13 +01:00
#!/bin/bash
DATAFILE=/tmp/fake-datafile
2018-12-05 17:58:55 +01:00
#----- collect the datas
2018-12-05 16:30:13 +01:00
> ${DATAFILE}
2018-12-13 19:39:06 +01:00
for s in $(seq 1 2000)
2018-12-05 16:30:13 +01:00
do
2018-12-07 08:52:41 +01:00
v=$(./fake-values -s -t 1 2> /dev/null)
2018-12-05 17:58:55 +01:00
echo $s $v >> ${DATAFILE}
2018-12-05 16:30:13 +01:00
done
2018-12-05 17:58:55 +01:00
#----- do dome useless computations
awk '
NR==1 { debut = $2 }
2018-12-13 19:39:06 +01:00
{
# print $2-debut, $3
v = int($3/25);
bucket[v]++;
}
END {
for (v=0; v<40; v++) {
for (foo=0; foo<bucket[v]; foo++) {
printf "-";
}
print "*"
}
}
2018-12-05 17:58:55 +01:00
' \
< ${DATAFILE}
2018-12-05 16:48:53 +01:00