/[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.2 - (hide annotations)
Wed Sep 11 18:11:07 2002 UTC (21 years, 7 months ago) by dpavlin
Branch: MAIN
Changes since 1.1: +4 -2 lines
File MIME type: text/plain
fixed brown bag bug

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

  ViewVC Help
Powered by ViewVC 1.1.26