Is the shack Pi still up?
Denis, KI7KLT · November 2026
This goes with HamAlert spots on a pager, and it uses the same app: Mast Pager, which I make, free on the App Store and on Google Play with no account. The app without an account includes one heartbeat, which is all this page needs, and heartbeats don't count against its 1,000 messages a month.
Most shacks have a Pi doing something nobody watches. A Pi-Star or WPSD hotspot. An AllStarLink node. A Direwolf iGate, a Winlink gateway, rigctld for the remote rig, a weather station feeding CWOP. It runs for months. Then one day you key up and nothing happens, and the only way to find out why is to walk over and look.
From the outside, every way a Pi dies looks the same. So turn it around: have the Pi check in with your phone every minute, and let the phone notice when it stops.
Mast calls that kind of check-in a heartbeat. The Pi fetches the alert source's address
on a schedule, with nothing attached; that's the heartbeat. When the gap between heartbeats
runs past the period plus a grace, the phone rings: shack-pi stopped reporting.
The next heartbeat that gets through closes it and sends a quiet
shack-pi recovered. An internet blip at 4 a.m. that fixes itself leaves nothing
for you to clean up.
The heartbeat starts on the Pi and goes all the way out to the internet. One line checks the power, the SD card, the Wi-Fi, the router and the ISP at once. A watchdog that runs on the Pi and logs to the Pi tells you nothing when the Pi is the problem.
You'll need to type a few commands on the Pi. SSH in from your computer, or plug in a
keyboard and screen. On Pi-Star, the web dashboard has a terminal under
Configuration → Expert → SSH Access, and you type rpi-rw first
because Pi-Star keeps the card read-only until you do. It goes back to read-only by itself
within the hour, and what you put in the crontab stays. WPSD doesn't need that step.
make a heartbeat, and pick how late is too late
New alert source, pick Heartbeat, call it shack-pi. Two numbers.
Heartbeat period is how often the Pi checks in. Grace is how long past
that Mast waits before it rings you. Under When it stops pick Pages if a
dead hotspot should wake you up, or Goes loud if it can wait till morning.
When does the phone ring?
One minute is right for something you want to know about now. For a Pi on a cellular link, or a weather station that only uploads every ten minutes, hourly is fine, and that's where a new heartbeat starts: every hour, ten minutes of grace. The grace covers the normal reasons a beat is late: slow DNS, a Wi-Fi reconnect, the router rebooting overnight. Five minutes of grace on a one-minute beat is five missed beats before anyone gets woken up.
send the heartbeat
The heartbeat is one command, curl, which fetches a web address. It's already
on the Pi, and the Pi's own scheduler, cron, runs it every minute.
Type crontab -e. The first time it asks
which editor to use; pick nano. Add this line at the bottom, then Ctrl-O,
Enter, Ctrl-X to save and leave:
* * * * * curl -fsS -m 20 --retry 2 https://mast.tissue.dev/mk_7b2e4c91a3d5f60817e2b9c4d5a6f7081920a3b4 >/dev/null 2>&1
The five stars mean "every minute". -fsS keeps curl quiet and makes
an error from the server count as a failure, -m 20 makes it give up after 20
seconds so a stuck request can't pile up behind the next one, and --retry 2
tries again if the first attempt didn't get through. Nothing to install.
A Windows or Mac machine in the shack can do the same. curl is on both, and Task
Scheduler or launchd runs it once a minute.
watch it arrive
Within a minute the alert source screen in Mast shows the last beat and how long ago. On an iPhone the home-screen widget draws each heartbeat as a dot, late ones marked. Now test it: pull the power on the Pi and wait six minutes. The phone rings. Plug it back in, and a minute or two after boot the page clears itself.
MAST · SHACK-PI04:17
shack-pi stopped reporting
No beat for 360s; expected every 60s.
Acknowledge Resolve Mute alert source 1h
MAST · SHACK-PI04:31
shack-pi recovered
Beat received after 14m 12s.
beat only when the program is running
The Pi being up isn't the same as the node being up. A Pi can answer on the network and
serve its web page while the radio does nothing. So don't beat
just because the Pi is on. Beat because the program you care about is running. Put a check
in front of the curl, joined with &&, which means "and only
if that worked". If the check fails, no beat goes out, and the heartbeat does the rest.
| What's on the Pi | Put this in front of the curl |
|---|---|
| Pi-Star, WPSD | pgrep -x MMDVMHost >/dev/null && curl … |
| AllStarLink | systemctl is-active --quiet asterisk && curl … |
| Direwolf iGate | pgrep -x direwolf >/dev/null && curl … |
| rigctld, remote rig | rigctl -m 2 -r localhost:4532 f 2>/dev/null | grep -qx '[0-9]*[1-9][0-9]*' && curl … |
| Anything with a web page | curl -fsS -m 5 http://localhost/ >/dev/null && curl … |
Each check asks the Pi whether that program is running. That catches a crash. It doesn't catch MMDVMHost running with a dead modem, or Asterisk up with no audio. The rig one in full, as it goes in the crontab:
* * * * * rigctl -m 2 -r localhost:4532 f 2>/dev/null | grep -qx '[0-9]*[1-9][0-9]*' && curl -fsS -m 20 https://mast.tissue.dev/mk_7b2e4c91a3d5f60817e2b9c4d5a6f7081920a3b4 >/dev/null 2>&1
Model 2 is Hamlib's network rig. This asks rigctld for the frequency, and
the grep lets the beat out only if a number came back. Hamlib 4.3 and later
report success even when the rig didn't answer, so the check has to read the reply. If
rigctld is dead or the rig is off, there's no number and no beat. If you built Hamlib
yourself, write /usr/local/bin/rigctl in full, because cron doesn't look there.
Let the Pi say what's wrong
A missed heartbeat says something's wrong. The Pi can also say what: send a message to
/fail on the end of the same address and Mast tells you right away with your
text, no waiting for the grace. It rings at whatever you picked under When it
stops, so it's a page only if that's set to Pages. The one worth having on every Pi except a Zero is the power check. Low voltage is
a common cause of lockups, and the Pi knows when it's happening. (A Zero has no low-voltage
detector, so there it never fires.)
Save this as power-check.sh in your home directory, run
chmod +x ~/power-check.sh once, and add the second line to your crontab.
#!/bin/sh
# power-check.sh run from cron every 5 minutes
url=https://mast.tissue.dev/mk_7b2e4c91a3d5f60817e2b9c4d5a6f7081920a3b4
t=$(vcgencmd get_throttled 2>/dev/null | cut -s -d= -f2)
[ -n "$t" ] || exit 0
# bit 0 = undervoltage right now, bit 16 = undervoltage at some point since boot
if [ $(( t & 0x10001 )) -ne 0 ] && [ ! -e /tmp/undervolt ]; then
# Tell Mast once per boot, and only mark it told if the message got through.
curl -fsS -m 20 -X POST "$url/fail" \
--data-urlencode "body=Undervoltage since boot ($t). Check the supply and the cable." >/dev/null \
&& touch /tmp/undervolt
fi*/5 * * * * $HOME/power-check.sh
A /fail with no title shows as shack-pi failed, with your text
under it. Same trick for anything the Pi can measure: disk almost full, CPU at 80 °C, SWR
from the amp, an RTL-SDR that dropped off lsusb.
Three things that stop most of these pages
-
Turn off Wi-Fi power save. It's on by default in Pi OS and it's a common
reason a Pi drops off Wi-Fi after a while. On Bookworm and later:
sudo nmcli con modify "<your wifi>" wifi.powersave 2, thensudo nmcli con up "<your wifi>".nmcli con showlists the names. Pi-Star doesn't havenmcli, so this one isn't for it. - Give the Pi a DHCP reservation on the router. Then a router reboot can't hand it a new address.
-
Use the official power supply. A phone charger on a thin cable is the
other usual cause.
vcgencmd get_throttledsays0x0when all is well. If it says0x50000or0x50005, that's the supply, and the script above turns it into a page. Other values are about heat.
Pi or internet? If anything else in the house can run the same one-line heartbeat, a NAS, another Pi, a Home Assistant box, give it its own heartbeat. If both go quiet, it's the internet or the power. If only the Pi goes quiet, it's the Pi.
Remote site. A Pi at the repeater site or in a friend's barn can't be power-cycled from the couch. The heartbeat tells you it's down. Getting it back is a smart plug, a DTMF reboot on an AllStar node (if the node itself is still running), or a drive. For a club repeater, make the trustee the heartbeat's escalation partner, so the page goes to a second person if the first one sleeps through it.
Jobs that run once a night. Not everything in the shack runs all the time. For a
nightly log backup or LoTW upload, a heartbeat can follow a
crontab schedule instead of a fixed period, and the job
can report how it went: add
/start to the address when it begins and the exit code when it ends. A
/0 is a good run; anything else is a failure with that code on it. The
run signals page has the one-line crontab for it.
A heartbeat tells you the Pi is quiet, not why. /fail covers what the Pi can
measure, and the rest is walking over, or a smart plug. If something here is wrong, write to
support@tissue.systems.
73,
Denis, KI7KLT
Clark County, Washington