mdisk: Use color, red for error messages and green for success
[sunny256-utils.git] / ngttest
blob8f827199c67ed7bc082cca55fd378f7843b1778b
1 #!/usr/bin/env bash
3 #=======================================================================
4 # ngttest
5 # File ID: b08ec95a-f743-11dd-a59e-000475e441b9
6 # Sjekker om den NextGenTel-forbindelsen er herpa
7 # License: GNU General Public License version 2 or later.
8 #=======================================================================
10 logdir=~/log/ngt
11 [ -d $logdir/. ] || mkdir -p $logdir || { echo $logdir: Gikk på trynet å lage den. >&2; exit 1; }
13 res=`sget http://nett.ba.no/ngt/test | tohex | rmspcall`
15 logfile=$logdir/logg.txt
16 echo -n `u -L` "Fikk \"$res\". " >>$logfile
17 if [ "$res" = "0a 00 00 02" ]; then
18 echo OK >>$logfile
19 tail -1 $logfile
20 exit 0
21 else
22 echo HERPA >>$logfile
23 tail -1 $logfile
24 exit 1