Using cron to trigger a POCSAG message
Using cron to trigger a POCSAG message
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
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
Re: Using cron to trigger a POCSAG message
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.
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.
Re: Using cron to trigger a POCSAG message
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
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
Re: Using cron to trigger a POCSAG message
Try using the /tmp directory instead of /home/pi-star. You should have write access either way.
Re: Using cron to trigger a POCSAG message
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.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
Sent via smoke signals using my SM-G935F
Andrew M1DNS.
Pi-star Admin Team.
Pi-star Admin Team.
Re: Using cron to trigger a POCSAG message
I'm not using Pi-Star commercially, it is for my own personal use., using amateur frequencies on a low power MMDVM pi-hat. I just want to know when my local fire station gets a turnout so I can tune my RX to the right frequency.
it was more of a "proof of concept" idea to see whether or not it was possible, and it is. I could go out and buy a Alphapoc 602 on VHF and do it that way, but that would be costly and boring.
Anyway, this is how I did it -
rtl-sdr dongle using rtl_fm and multimon-ng. Use a USB stick for read/write purposes. Pipe the output of multimon-ng to a text file on the USB stick.
Make a new document on the USB drive and name it. Then use the tail -F command to monitor the output file of multimon-ng to listen for chosen keyword and execute the paging command. chmod +x the file.
Setup a cron job to start at boot to execute rtl_fm and multimon-ng. Likewise with the monitor script. Job done.
it was more of a "proof of concept" idea to see whether or not it was possible, and it is. I could go out and buy a Alphapoc 602 on VHF and do it that way, but that would be costly and boring.
Anyway, this is how I did it -
rtl-sdr dongle using rtl_fm and multimon-ng. Use a USB stick for read/write purposes. Pipe the output of multimon-ng to a text file on the USB stick.
Make a new document on the USB drive and name it. Then use the tail -F command to monitor the output file of multimon-ng to listen for chosen keyword and execute the paging command. chmod +x the file.
Setup a cron job to start at boot to execute rtl_fm and multimon-ng. Likewise with the monitor script. Job done.
Re: Using cron to trigger a POCSAG message

Sent via smoke signals using my SM-G960F
Andrew M1DNS.
Pi-star Admin Team.
Pi-star Admin Team.
Re: Using cron to trigger a POCSAG message
Yep all doable, I'd use inotify to tell you when the file changes, depending on how many lines are written at once, I would then parse a few lines back, if your wanted information is in there fire off a message, all very do-able.G0FHM wrote: ↑Sat Jan 25, 2025 9:15 amI'm not using Pi-Star commercially, it is for my own personal use., using amateur frequencies on a low power MMDVM pi-hat. I just want to know when my local fire station gets a turnout so I can tune my RX to the right frequency.
it was more of a "proof of concept" idea to see whether or not it was possible, and it is. I could go out and buy a Alphapoc 602 on VHF and do it that way, but that would be costly and boring.
Anyway, this is how I did it -
rtl-sdr dongle using rtl_fm and multimon-ng. Use a USB stick for read/write purposes. Pipe the output of multimon-ng to a text file on the USB stick.
Make a new document on the USB drive and name it. Then use the tail -F command to monitor the output file of multimon-ng to listen for chosen keyword and execute the paging command. chmod +x the file.
Setup a cron job to start at boot to execute rtl_fm and multimon-ng. Likewise with the monitor script. Job done.
Re: Using cron to trigger a POCSAG message
Hi Andy,
I'm still using the tail -f way, as the only information I need to parse is the RIC. Most counties use one RIC per station (except Lincolnshire which use some bizarre combinations). Most fire alerters have no screen to relay incident details, they just go beep (I asked a friend of mine once who was a firefighter and he said it is done that way for a reason - If it was a car fire out in the sticks at 3am and a FF woke up and saw that on a screen, they'd turn over and go back to sleep!)
The multimon-ng output file is in this format -
2025-02-13 13:45:29: POCSAG512: Address: 159209 Function: 0 Alpha: Fire Call<NUL><NUL>
So in this case, 159209 belongs to West Walton (Norfolk), and the corresponding tail monitoring file looks like this -
!/bin/bash
tail -F /media/usb/output.txt | grep --line-buffered '159209' | while read ; do sudo RemoteCommand 7642 page 1743171 "FIRE CALL N59P5" ; done
I just set up a cron job with a suitable delay at boot to load the monitoring script(s) and away it goes. I'm running v4..2.1 on a Pi 3b and there is a 2 second delay between the RX of the signal and pistar transmitting the signal. Pretty damed impressive if you ask me!
Cheers,
J
I'm still using the tail -f way, as the only information I need to parse is the RIC. Most counties use one RIC per station (except Lincolnshire which use some bizarre combinations). Most fire alerters have no screen to relay incident details, they just go beep (I asked a friend of mine once who was a firefighter and he said it is done that way for a reason - If it was a car fire out in the sticks at 3am and a FF woke up and saw that on a screen, they'd turn over and go back to sleep!)
The multimon-ng output file is in this format -
2025-02-13 13:45:29: POCSAG512: Address: 159209 Function: 0 Alpha: Fire Call<NUL><NUL>
So in this case, 159209 belongs to West Walton (Norfolk), and the corresponding tail monitoring file looks like this -
!/bin/bash
tail -F /media/usb/output.txt | grep --line-buffered '159209' | while read ; do sudo RemoteCommand 7642 page 1743171 "FIRE CALL N59P5" ; done
I just set up a cron job with a suitable delay at boot to load the monitoring script(s) and away it goes. I'm running v4..2.1 on a Pi 3b and there is a 2 second delay between the RX of the signal and pistar transmitting the signal. Pretty damed impressive if you ask me!
Cheers,
J