My logging script for RSL and RSSI

Just for information this script formats RSL and RSSI for import into a standard spreadsheet.

#!/bin/sh

sleep 60

while true
do
        a=$(wget -q -O - http://127.0.0.1/DIRECT/getTunerStatus | jq .result.snr)
        echo -n $(date) ", "
        echo -n $a
        echo -n ", "
        a=$(wget -q -O - http://127.0.0.1/DIRECT/getTunerStatus | jq .result.rssi)
        echo $a
        sleep 60
done >> /mnt/downloads/RSL.csv

you place this in /mnt/conf/bin as the file user.sh with chmod 755.

It will log to /mnt/downloads/RSL.csv

You can use this in any spreadsheet to map your rsl over time.

If you don’t understand what that means let me know I will explain better.

-Cecil

3 Likes

This stupid highlighting system on this board makes hash bam into a bold instead of showing it.

The first line is #!..

Oh and that first sleep 60 makes sure the startup and radio is up before logging starts.

And only copy it to another system, if you delete or reset the log file the original task will loose track of the pipe and not write any updates until a reset.

This logs once every 60 seconds, if you want fewer logs you chan change that next to last line to like sleep 360 or so to get 5 minute logs.
-C

Oh if you have never used jq… Its’ a JSON query setup. So any type of JSON returns can be separated and returned with this call. You can get any data element by it’s . address in the query. There are even setups that you can make a query, and then learn the result, and then sub query them. Handy system.

Our request was going to come back as asked with all the fields, we got a lot, but we only wanted two, but remember the structure has ALL the fields.

With a web get we are asking for a JSON return with much data. We are processing the enteries we want to deal with, and discarding the others.

-Cecil

I write something like this, then I go back and edit it several times to make it better, but I always wonder if the poeple that read it the first time didn’t get the way I wanted to say it as i keep editing it and they read it.

I process thoughts in the screen, revise them, and sometimes rethink them totally. It’s a bother. The first people to read it only get my first thoughts. Later readers get a revised edition.

-C

Intentare probarlo, podrĂ­as subir el archivo al GoogleDrive donde se subieron los datos recopilados para inmarsat, asĂ­ evitamos errores al crearlo nosotros, es una idea.

Gracias.

Translation:

I tried to try it, you could upload the file to GoogleDrive where the data collected for inmarsat was uploaded, so we avoid mistakes when creating it, it’s an idea.

Thank you.

Probado y funcionando, con algunos cambios para adaptarlo a mis necesidades y mis circunstancias.

Muchas gracias por el script, me está costando un poquito esto de hacerlo todo por comandos, pero leyendo y leyendo y aprendiendo, la cosa va adelante, ahora que ya dominaba el “nano” me encuentro con el “vi”.

Ya puedo dejar descansar al PC.

Muchas gracias.

translation:

Tested and working, with some changes to suit my needs and my circumstances.

Many thanks for the script, it’s costing me a little bit to do everything by commands, but reading and reading and learning, the thing goes ahead, now that I already mastered the “nano” I encounter the “vi”.

I can rest the PC now.

Thank you very much.

re-formatted your script to “preformatted text” instead “quote” now all looks good, check out above.

thanks!

works nice! :slight_smile:
First it wasn’t running as copying the text from the forum filled in garbage “^M” carachters at end of lines… had to remove that manually in vi

Now:

Sun Feb 12 15:32:42 UTC 2017 , 5.79, -114.03
Sun Feb 12 15:32:53 UTC 2017 , 5.28, -113.98
Sun Feb 12 15:33:03 UTC 2017 , 5.65, -113.96
Sun Feb 12 15:33:13 UTC 2017 , 5.55, -114.05
Sun Feb 12 15:33:23 UTC 2017 , 5.51, -114.01
Sun Feb 12 15:33:34 UTC 2017 , 5.74, -113.91
Sun Feb 12 15:33:44 UTC 2017 , 5.9, -113.92

Thanks for the script!

I tried to open it with Excel but the date / time format is not recognized. I therefore changed the script to:

echo -n $(date -u “+%Y/%m/%d %H:%M:%S”) ", "

which gives:
2017/02/12 15:48:28 , 6.85, -113.04
2017/02/12 15:49:28 , 7.16, -112.85
2017/02/12 15:50:28 , 7.37, -113.01
2017/02/12 15:51:28 , 6.83, -112.84
2017/02/12 15:52:28 , 7.52, -112.95

Works perfectly for me too , thanks Cecil!
(made me have to remember my Vi commands too!! )

This is what it looks now in excel:

1 Like

LOL Now I AWAYS have RSL.csv at the top of the “what’s New” window :slight_smile:

great! :slight_smile:
Is there a was to run this user.sh automatically on boot up on Skylark? Right now I’m running from a separate ssh terminal.

Yes, the start on boot is part of the logic in /etc/init.d/S99user
You can test this by running:
sudo /etc/init.d/S99user start

To watch the SNR log coming in on a shell you can run:
tail -f /mnt/downloads/RSL.csv

1 Like

always learn something! :slight_smile: confirm that works nice

confirm that works seamless on google sheet as well! using left and right axis setup (checkbox) makes it really nice

I am also interested in the CRC errors, so added that in:

#!/bin/sh

sleep 60

while true
do
        all=$(wget -q -O - http://127.0.0.1/DIRECT/getTunerStatus)
        echo -n $(date -u "+%Y/%m/%d %H:%M:%S"),
        a=$(echo $all | jq .result.snr)
        echo -n $a,
        a=$(echo $all | jq .result.rssi)
        echo -n $a,
        a=$(echo $all | jq .result.crc_err)
        echo $a
        sleep 60
done >> /mnt/downloads/RSL.csv

Output (I have accumulated 69 CRC errors in the past 10 days):
2017/02/14 02:25:47,9.43,-111.95,69
2017/02/14 02:26:48,9.03,-111.92,69

1 Like

pretty cool!
one comment that when no crc error happens inserting a 0 would be good idea for excel plotting issues.

2017/02/14 13:55:37 , 4.46, -114.61
2017/02/14 13:55:59,4.59,-114.59,17
2017/02/14 13:56:07 , 4.74, -114.66
2017/02/14 13:56:29,4.9,-114.67,17
2017/02/14 13:56:37 , 4.69, -114.74
2017/02/14 13:56:59,4.83,-114.61,17
2017/02/14 13:57:07 , 4.42, -114.71
2017/02/14 13:57:29,4.9,-114.55,17
2017/02/14 13:57:37 , 4.84, -114.73
2017/02/14 13:57:59,5.42,-114.72,17
2017/02/14 13:58:08 , 4.85, -114.73
2017/02/14 13:58:30,4.95,-114.76,17
2017/02/14 13:58:38 , 4.92, -114.87
2017/02/14 13:59:00,5.39,-114.74,17
2017/02/14 13:59:08 , 5.62, -114.68
2017/02/14 13:59:30,4.65,-114.85,17
2017/02/14 13:59:38 , 5.03, -114.85
2017/02/14 14:00:00,4.75,-114.75,17
2017/02/14 14:00:08 , 5.12, -114.67
2017/02/14 14:00:31,4.75,-114.78,17
2017/02/14 14:00:39 , 4.35, -114.88

forget it… I need to do a reboot, now it’s fine:

2017/02/14 14:09:04,4.35,-115.26,0
2017/02/14 14:09:34,4.17,-114.82,0
2017/02/14 14:10:04,4.29,-115.08,0
2017/02/14 14:10:35,4.8,-115.12,0
2017/02/14 14:11:05,3.89,-115.21,0
2017/02/14 14:11:35,4.35,-115.17,0
2017/02/14 14:12:05,4.73,-115.1,0
2017/02/14 14:12:35,4.62,-115.08,0
2017/02/14 14:13:06,4.42,-115.08,0
2017/02/14 14:13:36,4.19,-115.08,0

You have both the old and the new script running.
Happened to me, too. The S99user restart command doesn’t kill the old process.