/[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

Contents of /omni2db.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations)
Wed Sep 11 20:54:24 2002 UTC (21 years, 7 months ago) by dpavlin
Branch: MAIN
Changes since 1.2: +10 -7 lines
File MIME type: text/plain
fix

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

  ViewVC Help
Powered by ViewVC 1.1.26