From: David K. <da...@ke...> - 2020-12-19 22:18:22
|
Thanks Lonnie, that explains what I was seeing. I have implemented the background trick you suggest. Thanks David On Sat, Dec 19, 2020 at 10:13 AM Lonnie Abelbeck <li...@lo...> wrote: > > > On Dec 19, 2020, at 7:54 AM, David Kerr <da...@ke...> wrote: > > > > Can anyone tell me when DNS comes up during the boot process? I am > doing a host lookup within my firewall custom rules script $(host -t A > $fqdn) and it appears to get no IP address when the firewall is setup > during boot, but works fine if I do a firewall restart after the system has > booted up. > > > > Thanks > > Hi David, > > The order of the startup "Snn*" script symlinks are: > > pbx3 ~ # cd /etc/runlevels/default/ > > pbx3 ~ # ls -l S* > ... > lrwxrwxrwx 1 root root 20 Dec 16 21:34 S03network -> > ../../init.d/network > lrwxrwxrwx 1 root root 19 Dec 16 21:34 S04elocal -> > ../../init.d/elocal > lrwxrwxrwx 1 root root 21 Dec 16 21:34 S05watchdog -> > ../../init.d/watchdog > lrwxrwxrwx 1 root root 22 Dec 16 21:34 S06lmsensors -> > ../../init.d/lmsensors > lrwxrwxrwx 1 root root 19 Dec 16 21:34 S08msmtpd -> > ../../init.d/msmtpd > lrwxrwxrwx 1 root root 18 Dec 16 21:34 S09crond -> > ../../init.d/crond > lrwxrwxrwx 1 root root 21 Dec 16 21:34 S10iptables -> > ../../init.d/iptables > lrwxrwxrwx 1 root root 23 Dec 16 21:34 S11netsyslogd -> > ../../init.d/netsyslogd > lrwxrwxrwx 1 root root 18 Dec 16 21:34 S11snmpd -> > ../../init.d/snmpd > lrwxrwxrwx 1 root root 23 Dec 16 21:34 S12keepalived -> > ../../init.d/keepalived > lrwxrwxrwx 1 root root 21 Dec 16 21:34 S18dnscrypt -> > ../../init.d/dnscrypt > lrwxrwxrwx 1 root root 20 Dec 16 21:34 S18unbound -> > ../../init.d/unbound > lrwxrwxrwx 1 root root 20 Dec 16 21:34 S20dnsmasq -> > ../../init.d/dnsmasq > ... > > So the firewall starts at S10, and DNS starts at S20. > > If you want to keep the $(host -t A $fqdn) in the firewall custom-rules, > you could spawn a background sub-shell, something like: > > https://github.com/astlinux-project/astlinux/blob/c3ff8beba28533487c65d77e9ec2d54dd9facc3b/package/openssh/sshd.init#L144 > > Off the top of my head , untested... > -- > fqdn="example.com" > ( > cnt=6 > while [ $cnt -gt 0 ]; do > cnt=$((cnt - 1)) > sleep 10 > > A="$(host -t A $fqdn | sed -n -r -e 's#^.* has address > ([0-9.]+)$#\1#p')" > if [ -n "$A" ]; then > ## use $A example ## > echo "$A" > /tmp/test > exit > fi > done > ) >/dev/null 2>&1 & > -- > > Adjust the retry 'cnt' and sleep delay to your liking. > > Lonnie > > > > > _______________________________________________ > Astlinux-devel mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/astlinux-devel > |