# HG changeset patch # User devi # Date 1135186260 -7200 # Node ID eab4f7df854c4586cd49632e8fb11efed7151cf7 # Parent f9447da96f15ba04efeb5fa5cbf2b19e09730e68 Исправлены глюки с обнаружением себя(l3-agent) в FreeBSD. Год задаётся как параметр year diff -r f9447da96f15 -r eab4f7df854c l3-agent --- a/l3-agent Wed Dec 21 14:39:44 2005 +0200 +++ b/l3-agent Wed Dec 21 19:31:00 2005 +0200 @@ -799,6 +799,7 @@ my $year = 2005; #$year = 2004 if ( $cl->{day} > 330 ); + $year = $Config{year} if $Config{year}; # timelocal( $sec, $min, $hour, $mday,$mon,$year); $cl->{time} = timelocal_nocheck($cl->{sec},$cl->{min},$cl->{hour},$cl->{day},0,$year); @@ -961,15 +962,18 @@ if (open(PIDFILE, $Config{agent_pidfile})) { my $pid = ; close(PIDFILE); - if ($^O eq 'linux' && (! -e "/proc/$pid" || !`grep $Config{"l3-agent"} /proc/$pid/cmdline && grep "uid:.*\b$<\b" /proc/$pid/status`)) { + if ($^O eq 'linux' && $pid &&(! -e "/proc/$pid" || !`grep $Config{"l3-agent"} /proc/$pid/cmdline && grep "uid:.*\b$<\b" /proc/$pid/status`)) { print "Removing stale pidfile\n"; unlink $Config{agent_pidfile} or die "Can't remove stale pidfile ". $Config{agent_pidfile}. " : $!"; } - elsif ($^O eq 'freebsd' && !`ps axo uid,pid,command | grep '$<.*$pid.*$Config{"l3-agent"}' 2> /dev/null`) { + elsif ($^O eq 'freebsd' && $pid && `ps axo uid,pid,command | grep '$<.*$pid.*$Config{"l3-agent"}' 2> /dev/null`) { + print "Removing stale pidfile\n"; + unlink $Config{agent_pidfile} + or die "Can't remove stale pidfile ". $Config{agent_pidfile}. " : $!"; } elsif ($^O eq 'linux' || $^O eq 'freebsd' ) { - print "l3-agent is already running\n"; + print "l3-agent is already running: pid=$pid; pidfile=$Config{agent_pidfile}\n"; exit(0); } else {