Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 7 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.

share|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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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