# HG changeset patch # User devi # Date 1131358993 -7200 # Node ID 450b6ac9b657b69fff5f30f3e24f9e1afd0fd8cf # Parent 098664cf339c4cf7874688843d14af469fcdde81 Незначительные исправления: * Исправлена обработка diff-файлов. Теперь они обрабатываются в реальном времени * Указан путь к mywi-client * Исправлен путь к иконкам google/freebsd/linux diff -r 098664cf339c -r 450b6ac9b657 l3-agent --- a/l3-agent Mon Nov 07 11:24:49 2005 +0200 +++ b/l3-agent Mon Nov 07 12:23:13 2005 +0200 @@ -18,7 +18,7 @@ our @Command_Lines; our @Command_Lines_Index; -our @Diffs; +our %Diffs; our %Sessions; our %Commands_Stat; # Statistics about commands usage @@ -57,6 +57,9 @@ my @files = <$path/$template>; my $i=0; for my $file (@files) { + + next if defined($Diffs{$file}); + my %diff; $diff{"path"}=$path; @@ -98,7 +101,8 @@ $diff{"text"}=$text; #print "$file loaded ($diff{day})\n"; - push @Diffs, \%diff; + #push @Diffs, \%diff; + $Diffs{$file} = \%diff; $i++; } } @@ -121,7 +125,8 @@ my $min_dt = 10000; - for my $diff (@Diffs) { + for my $diff_key (keys %Diffs) { + my $diff = $Diffs{$diff_key}; # Check here date, time and user next if ($diff->{"day"} && $cl->{"day"} && ($cl->{"day"} ne $diff->{"day"})); #next if (!$diff->{"uid"} && $cl->{"euid"} != $diff->{"uid"}); @@ -135,7 +140,8 @@ $diff->{"time_range"}=$dt; $diff->{"bind_to"}=$cl; - $cl->{"diff"} = $diff->{"index"}; + #$cl->{"diff"} = $diff->{"index"}; + $cl->{"diff"} = $diff_key; $min_dt = $dt; } @@ -262,7 +268,7 @@ $session{$1} = $2; } $local_session_id = $session{"local_session_id"} if $session{"local_session_id"}; - $Sessions{$session_id}=\%session; + $Sessions{$local_session_id}=\%session; } #Загруженную информацию сразу же отправляем в поток @@ -816,7 +822,7 @@ print OUT "\n"; if ($cl->{"diff"}) { print OUT ""; - printq(\*OUT,${$Diffs[$cl->{"diff"}]}{"text"}); + printq(\*OUT,${$Diffs{$cl->{"diff"}}}{"text"}); print OUT "\n"; } print OUT "\n"; @@ -846,9 +852,6 @@ sub send_cache { - `logger "step 0"`; - `logger "step 1"`; - # Если в кэше что-то накопилось, # попытаемся отправить это на сервер # @@ -913,9 +916,6 @@ init_variables(); init_config(); - for my $lab_log (split (/\s+/, $Config{"diffs"} || $Config{"input"})) { - load_diff_files($lab_log); - } if ($Config{"mode"} ne "daemon") { @@ -925,6 +925,9 @@ результат выполнения в результриующий файл. После этого завершить работу. =cut + for my $lab_log (split (/\s+/, $Config{"diffs"} || $Config{"input"})) { + load_diff_files($lab_log); + } load_command_lines($Config{"input"}, $Config{"input_mask"}); sort_command_lines; process_command_lines; @@ -970,6 +973,9 @@ while (not $Killed) { @Command_Lines = (); @Command_Lines_Index = (); + for my $lab_log (split (/\s+/, $Config{"diffs"} || $Config{"input"})) { + load_diff_files($lab_log); + } load_cache_stat(); load_command_lines($Config{"input"}, $Config{"input_mask"}); if (@Command_Lines) { diff -r 098664cf339c -r 450b6ac9b657 l3-frontend --- a/l3-frontend Mon Nov 07 11:24:49 2005 +0200 +++ b/l3-frontend Mon Nov 07 12:23:13 2005 +0200 @@ -58,7 +58,7 @@ for my $command (split /\s+/,$commands) { $command =~ s/'//g; my $description=""; - eval { $description=`mywi-client '$command'`; } ; + eval { $description=`/home/devi/bin/mywi-client '$command'`; } ; $description = join ("
\n", grep(/\([18]\)/, split(/\n/, $description))); $description =~ s/.*?-//; next if $description =~ /^\s*$/; @@ -457,15 +457,15 @@ %Search_Machines = ( "google" => { "query" => "http://www.google.com/search?q=" , - "icon" => "google.ico" }, + "icon" => "$Config{frontend_google_ico}" }, "freebsd" => { "query" => "http://www.freebsd.org/cgi/man.cgi?query=", - "icon" => "freebsd.ico" }, + "icon" => "$Config{frontend_freebsd_ico}" }, "linux" => { "query" => "http://man.he.net/?topic=", - "icon" => "linux.ico"}, + "icon" => "$Config{frontend_linux_ico}"}, "opennet" => { "query" => "http://www.opennet.ru/search.shtml?words=", - "icon" => "opennet.ico"}, + "icon" => "$Config{frontend_opennet_ico}"}, "local" => { "query" => "http://www.freebsd.org/cgi/man.cgi?query=", - "icon" => "freebsd.ico" }, + "icon" => "$Config{frontend_local_ico}" }, ); diff -r 098664cf339c -r 450b6ac9b657 l3config.pm --- a/l3config.pm Mon Nov 07 11:24:49 2005 +0200 +++ b/l3config.pm Mon Nov 07 12:23:13 2005 +0200 @@ -11,7 +11,7 @@ "skip_empty" => "yes", "skip_interrupted" => "no", "skip_wrong" => "no", - "editors" => ["vi", "pico", "ee", "vim"], + "editors" => ["vi", "pico", "ee", "vim", "nano"], "pagers" => ["more", "less", "zmore", "zless", "info", "man", "mc", "trafshow", "screen", "cfdisk", "trafshow-bsd", "yes", "lynx", "links", "centericq"