| author | stephen |
| Thu, 07 Sep 2017 14:02:18 +0100 | |
| changeset 63 | 5c92de4caca6 |
| parent 55 | 6559c3bacf09 |
| permissions | -rwxr-xr-x |
| stephen@0 | 1 |
#!/bin/bash |
| stephen@0 | 2 |
|
| stephen@5 | 3 |
#set -x |
| stephen@0 | 4 |
|
| stephen@5 | 5 |
if [[ "${@/noup}" != "$@" ]] |
| stephen@4 | 6 |
then |
| stephen@5 | 7 |
echo "no update attempted" |
| stephen@5 | 8 |
else |
| stephen@4 | 9 |
state=`./checkup.sh` |
| stephen@0 | 10 |
|
| stephen@4 | 11 |
if [ "$state" == "up" ] |
| stephen@4 | 12 |
then |
| stephen@28 | 13 |
# there's a chance of loss of battery.log here if device went |
| stephen@28 | 14 |
# down just as we're copying from it. But given we have all |
| stephen@28 | 15 |
# in mercurial that's ok, we can recover. |
| stephen@4 | 16 |
ssh basil.dsg.cs.tcd.ie scp loradtn@tunloradtn:/var/log/battery.log . |
| stephen@4 | 17 |
scp basil.dsg.cs.tcd.ie:battery.log . |
| stephen@4 | 18 |
./battery-seds.sh battery.log >sedded-battery.log |
| stephen@4 | 19 |
else |
| stephen@4 | 20 |
echo "Node not up." |
| stephen@5 | 21 |
exit |
| stephen@4 | 22 |
fi |
| stephen@4 | 23 |
fi |
| stephen@4 | 24 |
|
| stephen@5 | 25 |
if [[ "${@/today}" != "$@" ]] |
| stephen@4 | 26 |
then |
| stephen@4 | 27 |
today=`date --rfc-3339=date` |
| stephen@4 | 28 |
cat loradtn.gpl \ |
| stephen@4 | 29 |
| sed -e 's/2017-01-01/'$today'/' \ |
| stephen@59 | 30 |
| sed -e 's/2017-09-30/'$today'/' \ |
| stephen@4 | 31 |
| sed -e 's/loradtn.png/loradtn-'$today'.png/' \ |
| stephen@4 | 32 |
>daily/loradtn-$today.gpl |
| stephen@4 | 33 |
gnuplot daily/loradtn-$today.gpl |
| stephen@4 | 34 |
mv loradtn-$today.png daily |
| stephen@4 | 35 |
hg add daily/loradtn-$today.* |
| stephen@5 | 36 |
exit |
| stephen@4 | 37 |
fi |
| stephen@4 | 38 |
|
| stephen@5 | 39 |
others="${@/noup}" |
| stephen@4 | 40 |
|
| stephen@5 | 41 |
if [ "$others" != "" ] |
| stephen@5 | 42 |
then |
| stephen@5 | 43 |
# assume parameter is nicely formed date |
| stephen@10 | 44 |
theday=`echo $others | sed -e 's/ //g'` |
| stephen@5 | 45 |
cat loradtn.gpl \ |
| stephen@5 | 46 |
| sed -e 's/2017-01-01/'$theday'/' \ |
| stephen@59 | 47 |
| sed -e 's/2017-09-30/'$theday'/' \ |
| stephen@5 | 48 |
| sed -e 's/loradtn.png/loradtn-'$theday'.png/' \ |
| stephen@5 | 49 |
>daily/loradtn-$theday.gpl |
| stephen@5 | 50 |
gnuplot daily/loradtn-$theday.gpl |
| stephen@5 | 51 |
mv loradtn-$theday.png daily |
| stephen@5 | 52 |
hg add daily/loradtn-$theday.* |
| stephen@5 | 53 |
else |
| stephen@5 | 54 |
# generate new overview |
| stephen@5 | 55 |
gnuplot loradtn.gpl |
| stephen@5 | 56 |
fi |
| stephen@5 | 57 |
|
| stephen@5 | 58 |