I am banging my head against the wall here trying to figure this out. I have an automated DNS propagation system I am trying to build internally, and everything works except rndc flushname
. If I do this at a shell
prompt
$ sudo rndc flushname /var/lib/bind/$domain.hosts
$ sudo rndc reload
This works
Also if I create the following bash script:
#!/bin/bash
domain="some-domain.com"
# Do stuff
rndc flushname /var/lib/bind/$domain.hosts
rndc reload
And run it
$ sudo bash myScript.sh
It works.
This command is not working if I assign the script to a cron job though IE
$ sudo crontab -e
....
....
/5 * * * bash /etc/bind/dnsCron/dnsCron.sh
Why does rndc
work from straight shell. It also works manually called in a bash script. But when called from crontab it doesn't reload? All commands are run through sudo
and the crontab
is also running under root. I am not sure what the issue is here? Is there another method to call rndc flushname
?
rndc
is in /usr/sbin, and that is not in cron's (very minimal) PATH – steeldriver May 30 '23 at 21:24/usr/sbin/rndc flushname /var/lib/bind/$domain.hosts
-- Also keeping an eye on/var/mail/root
as all my cron jobs output there. I will report back after cron runs this next time .. – Zak May 30 '23 at 21:29