]> git.pld-linux.org Git - packages/Zope-TimerService.git/blob - Zope-timerserver_remover
- rel. 1
[packages/Zope-TimerService.git] / Zope-timerserver_remover
1 #!/usr/bin/perl -w
2 # Delete substring from zope.conf between two string
3 # For PLD by Ciesiel
4
5 use strict;
6 use locale;
7 use File::Copy;
8
9 my $plik_we;
10 my $plik_tmp;
11 my $first_string;
12 my $sec_string;
13 my $usun;
14
15     $plik_we="/etc/zope/main/zope.conf";
16     $plik_tmp="./zope_pld_tmp";   
17     $first_string="%import timerserver";
18     $sec_string="</timer-server>"; 
19     $usun=0;
20     
21 open (PLIK_WEJ,"$plik_we") || die "Error - File not found: $plik_we\n";
22 open (PLIK_WYJ,">$plik_tmp") || die "Error - File not found: $plik_tmp\n";
23
24 while (<PLIK_WEJ>)
25 {
26     if (/^$first_string/)
27     {    
28         ++$usun;
29     }
30
31     if (/^$sec_string/)
32     {
33         $usun=99999.5;
34     }    
35
36     if ($usun>0)
37     {
38         $_="";
39     }
40     print PLIK_WYJ;
41     
42     if ($usun==99999.5)
43     {
44         $usun=0;    
45     }
46 }
47
48 close(PLIK_WEJ);
49 close(PLIK_WYJ);
50 if ($usun==0)
51     {
52         move($plik_tmp,$plik_we);
53     }
54     else
55         {
56         unlink($plik_tmp);
57         print "\nNot found $first_string or $sec_string in zope.conf! - zope.conf not changed!\n";
58         }
This page took 0.061513 seconds and 3 git commands to generate.