jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [branches/] [HotSaNIC-0.5.0-pre6/] [diagrams.pl] - Blame information for rev 32

 

Line No. Rev Author Line
11simandl#!/usr/bin/env perl
2 
3# $Id: diagrams.pl,v 1.6 2004/07/11 22:39:38 bernisys Exp $
4 
5# include PERL libraries
6use strict;
7use warnings;
8use diagnostics;
9 
10# include HotSaNIC libraries
11use lib "./lib";
12use HotSaNICparser;
13 
14(my $VERSION = '$Revision: 1.6 $') =~ s/.*(\d+\.\d+).*/$1/;
15(my $IDENTIFIER = '$Id: diagrams.pl,v 1.6 2004/07/11 22:39:38 bernisys Exp $') =~ s/.*,v (.*) \$/$1/;
16 
17# read global settings
18#
19my %CONFIG=HotSaNICparser::get_config("./");
20 
21my $PIDFILE=$CONFIG{VARDIR}."/run/diagram.pid";
22my $PID=HotSaNICparser::get_pid($PIDFILE,"diagram");
23if ($PID > 0) {
24 print "diagram process already running on PID $PID\nchecking if stalled...\n";
25 if (-e $PIDFILE) {
26 my $runtime=time-(stat($PIDFILE))[10];
27 print "process running $runtime sec\n";
28 if ($runtime > 1800) {
29 print "Killing probably stalled diagram process on $PID\n";
30 kill 9,$PID;
31 }
32 else { print "seems ok - exiting normally.\n"; exit 0; }
33 }
34 }
35 
36open FILE,">$PIDFILE";
37print FILE $$;
38close FILE;
39 
40if (! -e $CONFIG{WEBDIR}) { mkdir $CONFIG{WEBDIR},0755; }
41 
42chdir "./modules";
43opendir DIR,".";
44my @files=grep /[a-zA-Z]+/,readdir DIR;
45closedir DIR;
46 
47foreach my $entry (sort @files) {
48 if ( (-d $entry) && ($entry ne "CVS") ) {
49 print "----- modules/$entry -----\n";
50 if ( (index($CONFIG{SHOW},$entry) >= 0) or ($CONFIG{SHOW} eq "*") ) {
51 chdir "./$entry";
52 if (-e "diagrams.pl") { system "./diagrams.pl"; } elsif (-e "diagrams") { system "./diagrams"; }
53 chdir "..";
54 }
55 else { print "Module not in SHOW - skipping...\n"; }
56 }
57 }
58 
59unlink $PIDFILE;
60 

Powered by WebSVN 2.2.1