Hi,
Have I done anything fundamentally wrong with this script (below)?
It's working as expected. I can't think of anything that's going to
blow up because of it, maybe someone else can. I don't think it needs
to be any more complicated than it is. Perhaps a small wait delay?
I've been using my mobile phone for my desktop computer's internet
access, lately, and pop.mail.yahoo.com.au DNS records were expiring
when off-line. Then, when going back on-line, fetchmail would fail to
get mail from yahoo, needing named to be manually reloaded to refresh
its DNS records.
Surprisingly, named wasn't trying to reload the records upon demand.
And this has only been a recent problem, so I'm guessing Yahoo may have
changed TTL lengths in the last few weeks. Fetchmail isn't running
constantly, just run once when I want to check for mail.
I wanted to restart named when a new network connection comes up, but
not do anything when it went down (so the LAN still carries on working
as expected). I don't think it matters if named is restarted when
*any* network connection comes up, not just my internet gateway.
#!/bin/sh
## /etc/NeworkManager/dispatcher.d/20-named
## added by me 19 Jan 2025
##
## Idea copied from 20-squid, to restart a service if a network goes up, if
## that service was already running. But do nothing if that service was
## stopped.
case "$2" in
up)
if [ -f /var/run/named/named.pid ]; then
/bin/systemctl reload named.service || :
fi
;;
esac
--
uname -rsvp
Linux 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
Boilerplate: All unexpected mail to my mailbox is automatically deleted.
I will only get to see the messages that are posted to the mailing list.