i want to do a setting to dynamically monitor my Work Station on my Wifi network. I've got my name server BIND and my dhcpd server all of that under linux working perfectly. But i didn't find any option to execute a script when dhcp give an IP to a machine. I would like to know if there is a way to do that. If there is no options for that i'll use the log files.

link|improve this question
feedback

1 Answer

up vote 4 down vote accepted

You can find the answer here:

Here's the copy-paste from the above link:

on commit {
        set ClientIP = binary-to-ascii(10, 8, ".", leased-address);
        set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
        log(concat("Commit: IP: ", ClientIP, " Mac: ", ClientMac));
        execute("/usr/sbin/my_script_here", "commit", ClientIP, ClientMac);
}

It might be different for different versions of Linux, but should give you the idea.

See here for another example:

man dhcpd.conf should also give you more information.

Baiscally, you want to use on commit and execute inside it to specify a script to be run.

link|improve this answer
It's the on commit examples in those links that you want. It's in the man page in the "Reference: events" section. icyrock.com, how about copy/paste one of those examples in your answer? – Doug Harris Nov 16 '10 at 14:38
@Doug Done, thanks! – icyrock.com Nov 16 '10 at 14:40
Perfect the key word commit was missing during my investigations. – Louis Nov 16 '10 at 14:51
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.