/[omni_gantt]/omni2db.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /omni2db.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.1.1 by dpavlin, Wed Sep 11 16:41:00 2002 UTC revision 1.3 by dpavlin, Wed Sep 11 20:54:24 2002 UTC
# Line 10  my $dbh = DBI->connect("DBI:Pg:dbname=ga Line 10  my $dbh = DBI->connect("DBI:Pg:dbname=ga
10  my %omni;  my %omni;
11    
12  sub db {  sub db {
13            return if (scalar keys %omni != 6);
14    
15          my $rv = $dbh->do("update gantt          my $rv = $dbh->do("update gantt
16                  set finish=now() where                  set finish=now() where
17                  sessionid='$omni{SessionID}' and                  sessionid='$omni{SessionID}' and
18                  type='$omni{Session_type}' and                  type='$omni{Session_type}' and
19                  status='$omni{Session_status}' and                  status='$omni{Session_status}' and
20                  user_group_host='".$omni{'User.Group@Host'}."' and                  user_group_host='".$omni{'User.Group@Host'}||''."' and
21                  specification='$omni{Backup_Specification}'");                  specification='$omni{Backup_Specification}'");
22    
23            print "rv: $rv\n" if ($debug);
24    
25          $dbh->do ("insert into gantt (sessionid,type,status,          $dbh->do ("insert into gantt (sessionid,type,status,
26                  user_group_host,specification) values                  user_group_host,specification) values
27                  ('$omni{SessionID}','$omni{Session_type}',                  ('$omni{SessionID}','$omni{Session_type}',
28                  '$omni{Session_status}',                  '$omni{Session_status}',
29                  '".$omni{'User.Group@Host'}."',                  '".$omni{'User.Group@Host'}."',
30                  '$omni{Backup_Specification}')") if ($rv eq "0E0");                  '$omni{Backup_Specification}')") if ($rv eq "0E0" || !$rv);
31  }  }
32    
33  open(O, "/usr/omni/bin/omnistat -detail |") || die "omnistat: $!";  open(O, "/usr/omni/bin/omnistat -detail |") || die "omnistat: $!";
34  while(<O>) {  while(<O>) {
35          chomp;          chomp;
36          if (/^$/) {          if (/^$/) {
37                  db() if (scalar keys %omni == 4);                  db();
38                  %omni = ();                  %omni = ();
39                  print "------------\n" if ($debug);                  print "------------\n" if ($debug);
40                  next;                  next;
41          }          }
42          s/^[\t\s]+//;          s/^[\t\s]+//;
43          my ($l,$r) = split (/\s*:\s*/,$_,2);          my ($l,$r) = split (/\s*:\s*/,$_,2);
44          $l =~ s/\s+/_/g;          if ($r) {
45          $r =~ s/\s+$//g;                  $l =~ s/\s+/_/g;
46          print "$l -> $r\n" if ($debug);                  $r =~ s/\s+$//g;
47          $omni{$l} = $r;                  print "$l -> $r\n" if ($debug);
48                            $omni{$l} = $r;
49            }
50  }  }
51  db();  db();
52  close(O);  close(O);

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.26