Using cron to trigger a POCSAG message

Here is where you can get help with using and setting up POCSAG and related topics
Post Reply
G0FHM
Posts: 59
Joined: Mon May 14, 2018 8:47 pm

Using cron to trigger a POCSAG message

Post by G0FHM » Fri Dec 20, 2024 11:43 am

Hi All,

This is probably more of a general Linux question, but seeing as it is a pistar box, here goes!

I would like to be able to monitor a text file at regular intervals (cron?), and if a given value is present within the file to then trigger a local message (I can do that bit already).

Basically what i'm doing: I'm monitoring a certain VHF POCSAG frequency (Fire Service alerters) via rtl-sdr and multimon-ng. Multimon has an output.txt feature that records all traffic to a text file. I want to be able to parse the file regularly, and if our local station gets a fire call (141209) Then trigger a LocalCommand message to my pager.... Just because!

It may be possible, it may not be!

Any help would be appreciated!

Thanks,

J

KN2TOD
Posts: 320
Joined: Sun Nov 11, 2018 6:36 pm

Re: Using cron to trigger a POCSAG message

Post by KN2TOD » Wed Dec 25, 2024 3:21 pm

I'd use a Python program, continuously running in a loop with an appropriate sleep setting, to scan the file and create the needed call to generate a page.

Look over /usr/local/sbin/pistar-remote as a template/model of what you can do for this approach.

You'd only need Cron to start the program on startups, but systemd would be a better choice for this.

G0FHM
Posts: 59
Joined: Mon May 14, 2018 8:47 pm

Re: Using cron to trigger a POCSAG message

Post by G0FHM » Sun Jan 05, 2025 8:17 am

Thanks for the reply, suggestion duly noted!

I've currently found a way around it - I pipe my rtl_fm output to a text file and then use :

tail -F /home/pi-star/output.txt | grep --line-buffered '141209' | while read ; do sudo RemoteCommand 7642 page 1743171 "FIRE CALL DMK" ; done

The biggest hurdle do far is getting pi-star into read-write mode before running rtl_fm, as the text file output requires a writeable partition. I have set a cron job to execute rpi-rw evey 5 minutes, but i'm not sure if that is actually working. At the moment i'm having to ssh in and run rtl_fm and tail in 2 different ssh windows. i'll try setting up a cron job to start them at boot (with a suitable sleep time to allow the system to come up fully).

I know my method works, as I got rudely awoken at 3.30am the first time I left it running - Although I could acknowledge the pager and go back to sleep unlike the poor souls that had to run to the station!

Thanks for your input and have a happy new year!

73

KN2TOD
Posts: 320
Joined: Sun Nov 11, 2018 6:36 pm

Re: Using cron to trigger a POCSAG message

Post by KN2TOD » Sun Jan 05, 2025 1:12 pm

Try using the /tmp directory instead of /home/pi-star. You should have write access either way.

M1DNS
Pi-Star Team
Posts: 1434
Joined: Thu Apr 05, 2018 5:30 am

Re: Using cron to trigger a POCSAG message

Post by M1DNS » Mon Jan 06, 2025 8:02 am

G0FHM wrote:
... Although I could acknowledge the pager and go back to sleep unlike the poor souls that had to run to the station!

73
Are you using pistar commercially? If so thats not part of the EULA. Mmdvmhost is also not to be used commercially. Both are provided for use with ham radio and no commercial use.

Sent via smoke signals using my SM-G935F


Andrew M1DNS.
Pi-star Admin Team.

Post Reply