1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-11-26 10:03:15 -05:00

Scripts API: SuperScanner: added more log messages and supervisord configuration example in readme

This commit is contained in:
f4exb 2020-05-30 17:53:55 +02:00
parent b947724710
commit 401faefdf5
2 changed files with 30 additions and 3 deletions

View File

@ -256,6 +256,31 @@ This file drives how channels in the connected SDRangel instance are managed.
}
```
<h3>Run with supervisord</h3>
Refer to supervisord documentation.
Esample of `superscanner.conf` file to put in your `/etc//etc/supervisor/conf.d/` folder (add it in the `[incude]` section of `/etc/supervisor/supervisord.conf`). Environment variable `PYTHONUNBUFFERED=1` is important for the log tail to work correctly.
```
[program:superscanner]
command = /opt/build/sdrangel/scriptsapi/venv/bin/python /opt/build/sdrangel/scriptsapi/superscanner.py -a 192.168.0.24 -c /home/f4exb/145M_scan.config.json -g 4 -r 3125 -f -65
process_name = superscanner
user = f4exb
stopsignal = INT
autostart = false
autorestart = false
environment =
USER=f4exb,
PATH="/home/f4exb/bin:/home/f4exb/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games",
HOME="/home/f4exb",
PYTHONUNBUFFERED=1
stdout_logfile = /home/f4exb/log/superscanner.log
stdout_logfile_maxbytes = 10MB
stdout_logfile_backups = 3
redirect_stderr=true
```
<h2>sdrangel.py</h2>
Holds constants related to SDRangel software required by other scripts

View File

@ -145,7 +145,7 @@ def on_ws_close(ws):
# ======================================================================
def on_ws_open(ws):
log_with_timestamp('Starting...')
log_with_timestamp('Web socket opened starting...')
def run(*args):
pass
thread.start_new_thread(run, ())
@ -224,8 +224,8 @@ def scan(struct_message):
freq_start = struct_message['cf']
freq_stop = struct_message['cf'] + struct_message['fft_bw']
else:
freq_start = struct_message['cf'] - (struct_message['fft_bw'] / 2);
freq_stop = struct_message['cf'] + (struct_message['fft_bw'] / 2);
freq_start = struct_message['cf'] - (struct_message['fft_bw'] / 2)
freq_stop = struct_message['cf'] + (struct_message['fft_bw'] / 2)
psd_samples = struct_message['samples']
psd_sum = 0
psd_count = 1
@ -419,9 +419,11 @@ def main():
global WS_URI
OPTIONS = get_input_options()
log_with_timestamp(f'Start with options: {OPTIONS}')
with open(OPTIONS.config_file) as json_file: # get base config
CONFIG = json.load(json_file)
log_with_timestamp(f'Initial configuration: {CONFIG}')
API_URI = f'http://{OPTIONS.address}:{OPTIONS.api_port}'
WS_URI = f'ws://{OPTIONS.address}:{OPTIONS.ws_port}'