Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.1:kernel-2.6.32
dhcp
leasestate
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File leasestate of Package dhcp
#! /usr/bin/perl # # Author: Kevin C. Miller <kevinm@andrew.cmu.edu> # http://www.andrew.cmu.edu/~kevinm/dhcp/failover.html # # The copyright is with the author. We (SuSE) include this script # with his permission. # use strict; my %LeaseBS; my %LeaseNBS; my %Update; my $level = 1; my $IP = ''; my ($ip, $bs, $nbs, $join); open(FILE, "/var/lib/dhcp/dhcpd.leases"); while(my $line = <FILE>) { next if ($line =~ /^\#/); if ($level == 1) { if ($line =~ /lease ([\d\.]+) \{/) { $level++; $IP = $1; $LeaseBS{$IP} = ''; $LeaseNBS{$IP} = ''; $Update{$IP} = 0; } }elsif($level == 2) { if ($line =~ /next binding state ([^\;]+)/) { $LeaseNBS{$IP} = $1; }elsif($line =~ /binding state ([^\;]+)/) { $LeaseBS{$IP} = $1; }elsif($line =~ /f_lupdate/) { $Update{$IP} = 1; }elsif($line =~ /\}/) { $level--; # print "$IP: $Leases{$IP}->[0] $Leases{$IP}->[1]\n"; $IP = ''; } } } close(FILE); format IP = @<<<<<<<<<<<<<<<<<< @<<<<<<<<< @ @<<<<<<<<< $ip, $bs, $join, $nbs . $~ = "IP"; print "IP Address Binding Next Binding\n"; foreach $ip (sort keys %LeaseBS) { $bs = $LeaseBS{$ip}; $nbs = $LeaseNBS{$ip}; $join = '>'; $join = '*' if ($Update{$ip}); write(STDOUT); }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor