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

Annotation of /omni2db.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide annotations)
Thu Sep 12 07:59:57 2002 UTC (21 years, 6 months ago) by dpavlin
Branch: MAIN
Changes since 1.3: +6 -4 lines
File MIME type: text/plain
more debug info, fix

1 dpavlin 1.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 dpavlin 1.3 return if (scalar keys %omni != 6);
14    
15 dpavlin 1.4 my $sql = "update gantt
16 dpavlin 1.1 set finish=now() where
17     sessionid='$omni{SessionID}' and
18     type='$omni{Session_type}' and
19     status='$omni{Session_status}' and
20 dpavlin 1.4 user_group_host='".$omni{'User.Group@Host'}."' and
21     specification='$omni{Backup_Specification}'";
22 dpavlin 1.1
23 dpavlin 1.4 my $rv = $dbh->do($sql);
24    
25     print "sql:\n$sql\nrv: $rv\n" if ($debug);
26 dpavlin 1.2
27 dpavlin 1.1 $dbh->do ("insert into gantt (sessionid,type,status,
28     user_group_host,specification) values
29     ('$omni{SessionID}','$omni{Session_type}',
30     '$omni{Session_status}',
31     '".$omni{'User.Group@Host'}."',
32 dpavlin 1.2 '$omni{Backup_Specification}')") if ($rv eq "0E0" || !$rv);
33 dpavlin 1.1 }
34    
35     open(O, "/usr/omni/bin/omnistat -detail |") || die "omnistat: $!";
36     while(<O>) {
37     chomp;
38     if (/^$/) {
39 dpavlin 1.3 db();
40 dpavlin 1.1 %omni = ();
41     print "------------\n" if ($debug);
42     next;
43     }
44     s/^[\t\s]+//;
45     my ($l,$r) = split (/\s*:\s*/,$_,2);
46 dpavlin 1.3 if ($r) {
47     $l =~ s/\s+/_/g;
48     $r =~ s/\s+$//g;
49     print "$l -> $r\n" if ($debug);
50     $omni{$l} = $r;
51     }
52 dpavlin 1.1 }
53     db();
54     close(O);

  ViewVC Help
Powered by ViewVC 1.1.26