diff --git a/scriptsapi/Readme.md b/scriptsapi/Readme.md index 7f9593b30..36a3a09b9 100644 --- a/scriptsapi/Readme.md +++ b/scriptsapi/Readme.md @@ -256,6 +256,31 @@ This file drives how channels in the connected SDRangel instance are managed. } ``` +

Run with supervisord

+ +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 +``` +

sdrangel.py

Holds constants related to SDRangel software required by other scripts diff --git a/scriptsapi/superscanner.py b/scriptsapi/superscanner.py index fbe622029..97d8ae28f 100644 --- a/scriptsapi/superscanner.py +++ b/scriptsapi/superscanner.py @@ -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}'