OP25 multi_rx.py as a service

Status
Not open for further replies.

krutzy

Member
Feed Provider
Joined
Sep 17, 2004
Messages
141
Location
Culpeper, VA
Something is driving me nuts. I am trying to get multi_rx.py to run as a service. It runs if I start it in a terminal window. I cannot get it to run as a service. It just stops.

My shell script I call multi.sh which looks like this:

./multi_rx.py -c rtlsdr.json -T kutrunk.tsv -l http:0.0.0.0:8080 -X -v 11 > multierr.2 2>&1

The service looks like this (the only thing different from the rx.py service is the what get's started)

[Unit]
Description=op25-multi_rx
After=syslog.target network.target nss-lookup.target network-online.target
Requires=network-online.target

[Service]
User=1000
Group=1000
WorkingDirectory=/home/pi/op25/op25/gr-op25_repeater/apps
ExecStart=/bin/bash -- multi.sh
RestartSec=5
Restart=on-failure

[Install]
WantedBy=multi-user.target

The only thing in the output file is the following lines:

added talkgroup 3403 from ku-tgid-blacklist.tsv
added talkgroup 3601 from ku-tgid-blacklist.tsv
1673665886.425344 find_channel_cc: selected channel 1 (P25 Control Channel) for tuning request type cc frequency 853.237500
python version detected: 3.9.2 (default, Mar 12 2021, 04:06:34)
[GCC 10.2.1 20210110]
Allocating 15 zero-copy buffers
Allocating 15 zero-copy buffers
Running. press ENTER to quit
Quitting - now stopping top block
Program ending

Like it starts and just ends. No rhyme or reason I can find. Just to be thorough here is my rtlsdr.json:

{
"channels": [
{
"demod_type": "cqpsk",
"destination": "udp://127.0.0.1:56124",
"excess_bw": 0.2,
"filter_type": "rc",
"frequency": 0,
"if_rate": 24000,
"name": "P25 Control Channel",
"plot": "constellation",
"decode": "p25_decoder:cc",
"symbol_rate": 4800,
"decode": "p25_decoder:role=cc:dev=rtlsdrcc"
},
{
"demod_type": "cqpsk",
"destination": "udp://127.0.0.1:23456",
"excess_bw": 0.2,
"filter_type": "rc",
"frequency": 0,
"if_rate": 24000,
"name": "P25 Voice Channel",
"plot": "constellation",
"decode": "p25_decoder:vc",
"symbol_rate": 4800,
"decode": "p25_decoder:role=vc:dev=rtlsdrvc"
}
],
"devices": [
{
"args": "rtl=00000002",
"frequency": 0,
"gains": "lna:30",
"name": "rtlsdrcc",
"offset": 0,
"ppm": 0,
"rate": 1000000,
"tunable": true
},
{
"args": "rtl=00000001",
"frequency": 0,
"gains": "lna:30",
"name": "rtlsdrvc",
"offset": 0,
"ppm": 0,
"rate": 1000000,
"tunable": true
}
]
}

Any ideas why this might not be running?

Thank you. Kevin
 

belvdr

No longer interested in living
Joined
Aug 2, 2013
Messages
2,567
Does the same thing happen if you run your Exec line manually:
Code:
/bin/bash -- multi.sh
 
Last edited:

krutzy

Member
Feed Provider
Joined
Sep 17, 2004
Messages
141
Location
Culpeper, VA
I haven't tried it specifically that way. However a friend just told me something to try that might be the problem. It has to do with the http address being 0.0.0.0 where in rx.py I have IP address of the Pi. When I have time I will try it.
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,411
Location
Talbot Co, MD
There is an example service definition in the apps directory called "op25-rx.service". Use that as a starting point and modify as needed.

OP25's main requirement for running as a service is that you configure it with the web terminal. The curses terminal will not run headless.

Also, you'll need to get rid of this section of your command line "-T kutrunk.tsv -l http:0.0.0.0:8080 -X" otherwise it will error out. All that stuff applies only to rx.py, and not multi_rx.py. Modify the .json file if you want to set up trunking and the terminal.
 

krutzy

Member
Feed Provider
Joined
Sep 17, 2004
Messages
141
Location
Culpeper, VA
Thanks boatbod. I wondered about that as well.

The osmocom source directory does not have an example. The only one I see is op25-liq. However, I believe I did use your op25 multi_rx.service as my starting point. This all makes more sense now. Thank you. Hopefully I can test soon but have a busy weekend.
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,411
Location
Talbot Co, MD
Thanks boatbod. I wondered about that as well.

The osmocom source directory does not have an example. The only one I see is op25-liq. However, I believe I did use your op25 multi_rx.service as my starting point. This all makes more sense now. Thank you. Hopefully I can test soon but have a busy weekend.
Sorry, I can't help you with Osmocom. It's different enough at this point that there may be other dependencies.
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
1,029
Location
NE Wisconsin
Something is driving me nuts. I am trying to get multi_rx.py to run as a service. It runs if I start it in a terminal window. I cannot get it to run as a service. It just stops.

My shell script I call multi.sh which looks like this:

./multi_rx.py -c rtlsdr.json -T kutrunk.tsv -l http:0.0.0.0:8080 -X -v 11 > multierr.2 2>&1

Kevin,

Osmocom's multi_rx.py expects to be run from a curses terminal and is happy so long as you start the
applicaton accordingly. However, when starting it as a service, you no longer have an attached terminal
that is now casing it to abort execution.

The fix is to include -M false along with your other multi_rx.py command line arguments.

Bill
 
Last edited:

krutzy

Member
Feed Provider
Joined
Sep 17, 2004
Messages
141
Location
Culpeper, VA
Bill that was it. It is working now thanks to you!!!

If I could ask one more question. I know my one rtl-sdr works well with a value of "-d -260". would that the equivalent to the "offset" in the json?
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
1,029
Location
NE Wisconsin
Bill that was it. It is working now thanks to you!!!

If I could ask one more question. I know my one rtl-sdr works well with a value of "-d -260". would that the equivalent to the "offset" in the json?

I am glad to hear that op25 is now running as a service! To answer your last question, you obviously had the -d option as a tool to force frequency corrections when using rx.py. However, and to be honest, some SDR devices don't respond well to this means of correcting for tuning errors. I've found by trial and error where RTL SDR's are concerned, that you often have to find a combination of values specified for ppm against values that you might specify for an offset to achieve the desired degree of tuning accuracy.

Start by determining the optimum ppm, and then, if necessary, introduce values experimentally for offset. Keep in mind that offset was intended as a means to relocate a natural D.C. spike or signal artifact that usually sits in the center of the spectrum amd can sometimes interfere with the desired signal(s).

As a rule of thumb, I start with an offset of 2500 and then trim up/down in 100 Hz increments while observing the overall frequency error on the control channel. You may have to try negative or positive offset values. It really varies quite a bit from device to device, even when they are of the same manufacture and model number.

The good news is that the -X option will compensate for most tuning errors so long as you have selected a ppp correction value that places the center tuning within reasonable tolerances. While -X is enabled in Osmocom, observe the reported tuning errors as a guide in adjusting your ppm and offsets. This process can take several attempts to get it dialed in, but eventually you'll get there.

One other suggestion when using two or more SDR’s is to swap the labels (names) of the devices as defined in your p25 decoder role lines such that you can make each device temporarily serve as the control channels SDR. The idea is to facilitate tuning of each device against a known and steady signal.

Bill
 

krutzy

Member
Feed Provider
Joined
Sep 17, 2004
Messages
141
Location
Culpeper, VA
I understand. I know it will take some experimentation. I know the -X works well with rx.py. I just needed to get a good starting point because when I see a 1 or 2 in the error band column that I know it is too out of whack.

Funny I though of doing the swapping of devices to be able zero in the other rtl-sdr.

Thank you for the pointers! I think I can go forward from.
 
Status
Not open for further replies.
Top