Reload config files automatically as non root
Glenn Satchell
glenn.satchell at uniq.com.au
Wed Nov 16 14:12:09 UTC 2011
On 11/17/11 00:14, Siobhan Keehan wrote:
> Hi,
> I have a user that can add hosts and networks to dhcp, but as they are
> not root do not have the permissions to restart the dhcpd.
> Is there any way of configuring dhcpd to allow it to reread the config
> files automatically for example every minute
> Thanks
>
You could have a script run from cron every minute. In the script check
the modification time of the dhcpd.conf file, plus any included files.
If changed since the previous check then do a syntax check (dhcpd -t)
and if that is ok restart dhcpd.
When you restart dhcpd, touch a reference file in /tmp. Next time you
run, check if the dhcpd.conf is newer than the reference file, if it is,
then it must have been updated and dhcpd should be restarted
Something like this:
if [ -f /tmp/ref ]; then
if [ /etc/dhcpd.conf -nt /tmp/ref ]; then
touch /tmp/ref
/etc/init.d/dhcpd restart
fi
else
touch /tmp/ref
fi
--
regards,
-glenn
More information about the dhcp-users
mailing list