Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Thursday, October 15, 2026

Diff for scripts/perl/syswatcher/syswatcher.pl between version 1.5 and 1.6

version 1.5, 2003/11/24 18:35:45 version 1.6, 2003/12/11 13:04:56
Line 13 
Line 13 
 # 16/10/2003 - added automatic database reconnecting (nepto)  # 16/10/2003 - added automatic database reconnecting (nepto)
 #  #
   
 # $Platon: scripts/syswatcher/syswatcher.pl,v 1.4 2003/11/14 09:53:51 rajo Exp $  # $Platon: scripts/syswatcher/syswatcher.pl,v 1.5 2003/11/24 18:35:45 rajo Exp $
   
 use strict;  use strict;
   
Line 49  $update_interval    = 10; # seconds
Line 49  $update_interval    = 10; # seconds
 # MAIN  # MAIN
 #  #
   
   FORK: {
           my $pid;
           if ($pid = fork) {
                   # parent
                   exit 0;
           }
           elsif (defined $pid) {
                   # child
           }
           elsif ($! =~ /No more process/) {
                   # EAGAIN
                   warn "Can't fork: $!";
                   sleep 5;
                   redo fork;
           }
           else {
                   die "Can't fork: $!";
           }
   }
   
 print_info("PID = $$ $0 started");  print_info("PID = $$ $0 started");
   
 while (1) {  while (1) {
Line 70  while (1) {
Line 90  while (1) {
                 my $modify_time = -86400.0 * -M $0;                  my $modify_time = -86400.0 * -M $0;
                 if (defined $modify_time && $modify_time > 0) { # Autorestart - if file exists and is modified                  if (defined $modify_time && $modify_time > 0) { # Autorestart - if file exists and is modified
                         print_info("Script '$0' MODIFIED $modify_time seconds after startup, restarting ...");                          print_info("Script '$0' MODIFIED $modify_time seconds after startup, restarting ...");
                         exec $0;                          exec $0, @ARGV;
                 }                  }
         }          }
   
Line 126  sub loadavg()
Line 146  sub loadavg()
   
         $sql_loadavg->execute(          $sql_loadavg->execute(
                 $load1, $load5, $load15, $procs_run, $procs_total, $last_pid) or warn $dbh->errstr;                  $load1, $load5, $load15, $procs_run, $procs_total, $last_pid) or warn $dbh->errstr;
         print_info("Loadavg inserted");          #print_info("Loadavg inserted");
   
         close FILE;          close FILE;
   
Line 153  sub meminfo()
Line 173  sub meminfo()
                 $xx{LowFree},           $xx{SwapTotal}, $xx{SwapFree},          $xx{Dirty},             $xx{Writeback},                  $xx{LowFree},           $xx{SwapTotal}, $xx{SwapFree},          $xx{Dirty},             $xx{Writeback},
                 $xx{Mapped},            $xx{Slab},              $xx{Committed_AS},      $xx{PageTables},$xx{VmallocTotal},                  $xx{Mapped},            $xx{Slab},              $xx{Committed_AS},      $xx{PageTables},$xx{VmallocTotal},
                 $xx{VmallocUsed},       $xx{VmallocChunk}, $xx{HugePages_Total}, $xx{HugePages_Free}, $xx{Hugepagesize}                  $xx{VmallocUsed},       $xx{VmallocChunk}, $xx{HugePages_Total}, $xx{HugePages_Free}, $xx{Hugepagesize}
                 ) or warn $dbh->errstr;          ) or warn $dbh->errstr;
         print_info("Meminfo inserted");          #print_info("Meminfo inserted");
   
         return 1;          return 1;
   

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top