#!/usr/bin/perl -T # # Tail the httpd access log file and change the pxelinux.cfg link so that # the host doesn't do multiple installs # Harry Hoffman new(name=>$httpdlog,maxinterval=>5,adjustafter=>3); while ( defined(my $line = $file->read) ) { my $line = "GET /Profiles/10.0.1.2-kickstart HTTP/1.0\" 200"; if ($line =~ /.*\/(\d+\.\d+\.\d+\.\d+)-kickstart HTTP\/1\.0\" 200.*/) { my $ip = $1; my $hexip = dec2hex($ip); print "$hexip\n"; chdir $pxecfgdir or die "unable to move into $pxecfgdir: $!\n"; unlink $hexip; symlink($localboot,$hexip) or die "unable to create symlink: $!\n"; } } } sub dec2hex { my $ip=shift; my @matches = split(/\./,$ip); my $hexip = ""; foreach (@matches) { $_ = sprintf("%02x",$_); $hexip = "$hexip" . "$_"; } $hexip =~ tr/a-f/A-F/; return $hexip; }