Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: put dhcp leases into database

by varalaxmibbnl (Acolyte)
on Jan 17, 2014 at 12:19 UTC ( #1070941=note: print w/replies, xml ) Need Help??


in reply to Re: put dhcp leases into database
in thread put dhcp leases into database

Thanks for the reply

my script works for but some times it repeats the data in database... i just don't want to repeat the data in database...as soon as the lease is created i want it to be written it into database...

Replies are listed 'Best First'.
Re^3: put dhcp leases into database
by karlgoethebier (Prior) on Jan 17, 2014 at 12:56 UTC
    "...it repeats the data in database..."

    Does that mean the same data is written twice or more to your database?

    If so, i guess a bit :-( Can't you remember the mtime of dhcpd.leases and write the data only to your DB if dhcpd.leases was updated?

    But this might get a little bit more complicated:

    "...Every time a lease is acquired, renewed or released, its new value is recorded at the end of the lease file. So if more than one declaration appears for a given lease, the last one in the file is the current one..."

    And:

    "...In order to prevent the lease database from growing without bound, the file is rewritten from time to time. First, a temporary lease database is created and all known leases are dumped to it. Then, the old lease database is renamed /var/lib/dhcpd/dhcpd.leases~. Finally, the newly written lease database is moved into place..."

    See also dhcpd.leases.

    Update: Net::ISC::DHCPd::Leases might be interesting. I didn't use it but perhaps it's worth to take a look at.

    Regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1070941]
help
Chatterbox?
[Discipulus]: 'give man a fish erix it sonds like a push towards omosexuality.. ;=)
[Discipulus]: see Re: from txt file to array erix
[erix]: yeah, I ask for the text (I don't see signatures)
[Discipulus]: dear brother karl has "Furthermore I consider that Donald Trump must be impeached as soon as possible" in his sig
[erix]: ah, thanks Discipulus
[1nickt]: erix perhaps you could kindly point out your technique to roho and everyone will be happy.
[Discipulus]: but i'm also animalist, so i' hirted by 1nickt's sig: The way forward always starts with a mammal test... grin..
[erix]: I might if I did remember. It's probably somewhere in the site docs
[uhClem]: I don't favor that sort of thing around here but the place for our politics is wherever we live.

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2017-06-22 12:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (519 votes). Check out past polls.