/[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.4 - (show 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 #!/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 $sql = "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 my $rv = $dbh->do($sql);
24
25 print "sql:\n$sql\nrv: $rv\n" if ($debug);
26
27 $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 '$omni{Backup_Specification}')") if ($rv eq "0E0" || !$rv);
33 }
34
35 open(O, "/usr/omni/bin/omnistat -detail |") || die "omnistat: $!";
36 while(<O>) {
37 chomp;
38 if (/^$/) {
39 db();
40 %omni = ();
41 print "------------\n" if ($debug);
42 next;
43 }
44 s/^[\t\s]+//;
45 my ($l,$r) = split (/\s*:\s*/,$_,2);
46 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 }
53 db();
54 close(O);

  ViewVC Help
Powered by ViewVC 1.1.26