lilalo

diff l3-agent @ 54:f1ba68510fed

Обработка элемента ipaddress в элементе host
author devi
date Thu Dec 22 08:30:38 2005 +0200 (2005-12-22)
parents f9447da96f15
children 43aeb3036aaa
line diff
     1.1 --- a/l3-agent	Wed Dec 21 14:39:44 2005 +0200
     1.2 +++ b/l3-agent	Thu Dec 22 08:30:38 2005 +0200
     1.3 @@ -799,6 +799,7 @@
     1.4  
     1.5  		my $year = 2005;
     1.6  		#$year = 2004 if ( $cl->{day} > 330 );
     1.7 +		$year = $Config{year} if $Config{year};
     1.8  		# timelocal(			$sec,	   $min,      $hour,      $mday,$mon,$year);
     1.9  		$cl->{time} = timelocal_nocheck($cl->{sec},$cl->{min},$cl->{hour},$cl->{day},0,$year);
    1.10  
    1.11 @@ -961,15 +962,18 @@
    1.12  		if (open(PIDFILE, $Config{agent_pidfile})) {
    1.13  			my $pid = <PIDFILE>;
    1.14  			close(PIDFILE);
    1.15 -			if ($^O eq 'linux' && (! -e "/proc/$pid" || !`grep $Config{"l3-agent"} /proc/$pid/cmdline && grep "uid:.*\b$<\b" /proc/$pid/status`)) {
    1.16 +			if ($^O eq 'linux' && $pid &&(! -e "/proc/$pid" || !`grep $Config{"l3-agent"} /proc/$pid/cmdline && grep "uid:.*\b$<\b" /proc/$pid/status`)) {
    1.17  				print "Removing stale pidfile\n";
    1.18  				unlink $Config{agent_pidfile}
    1.19  					or die "Can't remove stale pidfile ". $Config{agent_pidfile}. " : $!";
    1.20  			}
    1.21 -			elsif ($^O eq 'freebsd' && !`ps axo uid,pid,command | grep '$<.*$pid.*$Config{"l3-agent"}' 2> /dev/null`) {
    1.22 +			elsif ($^O eq 'freebsd' && $pid && `ps axo uid,pid,command | grep '$<.*$pid.*$Config{"l3-agent"}' 2> /dev/null`) {
    1.23 +				print "Removing stale pidfile\n";
    1.24 +				unlink $Config{agent_pidfile}
    1.25 +					or die "Can't remove stale pidfile ". $Config{agent_pidfile}. " : $!";
    1.26  			}
    1.27  			elsif ($^O eq 'linux' || $^O eq 'freebsd' ) {
    1.28 -				print "l3-agent is already running\n";
    1.29 +				print "l3-agent is already running: pid=$pid; pidfile=$Config{agent_pidfile}\n";
    1.30  				exit(0);
    1.31  			}
    1.32  			else {