DD2-monitor/exemple.sh

34 lines
475 B
Bash
Raw Normal View History

2018-12-06 02:30:13 +11:00
#!/bin/bash
DATAFILE=/tmp/fake-datafile
2018-12-06 03:58:55 +11:00
#----- collect the datas
2018-12-06 02:30:13 +11:00
> ${DATAFILE}
2018-12-14 05:39:06 +11:00
for s in $(seq 1 2000)
2018-12-06 02:30:13 +11:00
do
2019-01-17 19:45:57 +11:00
v=$(./fake-values -s -t 1)
2018-12-06 03:58:55 +11:00
echo $s $v >> ${DATAFILE}
2018-12-06 02:30:13 +11:00
done
2018-12-06 03:58:55 +11:00
#----- do dome useless computations
awk '
NR==1 { debut = $2 }
2018-12-14 05:39:06 +11: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-06 03:58:55 +11:00
' \
< ${DATAFILE}
2018-12-06 02:48:53 +11:00