/[CCFs]/bin/deleteccf
ViewVC logotype

Diff of /bin/deleteccf

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by ccflib, Mon Mar 18 18:28:57 2002 UTC revision 1.8 by ccflib, Tue Jul 27 13:09:16 2021 UTC
# Line 1  Line 1 
1  #! /usr/local/bin/perl -w  #! /usr/bin/env perl
2    #! /xdata/ccflib/perl5/perlbrew/perls/perl-5.18.4/bin/perl
3  #  #
4  # Giuseppe Vacanti (cosine science & computing bv)  # $Id: deleteccf,v 1.7 2020/07/04 11:59:30 ccflib Exp $
 #  
 # $Id$  
5  #  #
6    # Script to be run from crontab to delete any CCFs in
7    # /home/ccflib/ftp-area/private/ccfdevel/deleted
8    
9  require 5;  require 5;
10  use strict;  use strict;
11  use lib "/data/xmm/ccflib/cgi";  use warnings;
12  $Env{'PATH'} .= "/data/xmm/ccflib/bin:";  use vars '%ENV';
 use Ccflib;  
13    
14  chdir $Ccflib::develrm or die("Cannot access $Ccflib::develrm\n");  # If DEBUG is set, warns without executing
15    
16  my $deletes;  my $debug = "";
17  foreach my $ccf (glob("*.CCF")){  if ( $ENV{'DEBUG'} ) {
18    qx/rm -f $ccf/;          $debug = "$ENV{'DEBUG'}";
   if(! $? >> 8){  
     warn("Deletion of $ccf failed\n");  
   } else {  
     $deletes .= "$ccf ";  
   }  
19  }  }
20    
 my $x = qx/ccfnotify -t development -d $deletes/;  
21    
22  if(! $? >> 8){  my $host=qx/\/bin\/hostname/ ;
23    warn("Notification failed\n");  chomp($host);
 }  
24    
25    chdir "/home/ccflib/ccf_ftp/private/ccfdevel/deleted/";
26    
27    
28    my $deletes;
29    foreach my $ccf (glob("*.CCF")){
30            if ($debug) {
31                    print "$ccf is marked for deletion\n";
32            } else {
33                    print "Going to delete $ccf\n";
34                    unlink $ccf;
35                    if(! $? >> 8){
36                            warn("Deletion of $ccf failed\n");
37                    } else {
38                            $deletes .= "$ccf ";
39                    }
40            }
41    }
42    if(! $debug && $deletes){
43            print "Script deleteccf running on $host\n";
44            print "Removed CCFs:\n";
45            print "             $deletes\n";
46    }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.27