/[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.1 - (hide annotations)
Wed Sep 11 16:41:00 2002 UTC (21 years, 7 months ago) by dpavlin
Branch: MAIN
Branch point for: DbP
File MIME type: text/plain
Initial revision

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

  ViewVC Help
Powered by ViewVC 1.1.26