I’m looking for a method of connecting automatically after a power failure. Since this node will be on a cell modem with a VPN, there needs to be a delay also.
Something that runs on boot, waits say 5 minutes, and then executes the link command would be great. A startup macro? How do you do the delay and connection on startup?
An alternative would be a program or script that connects after seeing the link down for say 5 minutes. Cron?
Assuming that for some reason you’re trying to avoid the app_rpt “on startup” macro capability, this is trivially done with a systemd unit file of the type “onshot” and a timer using the OnBootSec= modifier. Something like (note - this is off the top of my head, not tested)
In /etc/systemd/system/asl-relink.service:
[Unit]
Description = Relink ASL on boot
After = asterisk.service
[Service]
Type=oneshot
ExecStart=/usr/bin/asterisk -rx 'rpt cmd NODE ilink 3 NNNNN'
In /etc/systemd/system/asl-relink.timer:
[Unit]
Description=Relink ASL on boot after 5 minutes
[Timer]
OnBootSec=300
[Install]
WantedBy=timers.target
Obviously you’d need to set NODE and NNNNN to the right things for your system.