/[CCFs]/bin/deleteccf
ViewVC logotype

Annotation of /bin/deleteccf

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (hide annotations)
Tue Jul 27 13:09:16 2021 UTC (3 years, 3 months ago) by ccflib
Branch: MAIN
CVS Tags: HEAD
Changes since 1.7: +31 -24 lines
Tested to work

1 ccflib 1.8 #! /usr/bin/env perl
2     #! /xdata/ccflib/perl5/perlbrew/perls/perl-5.18.4/bin/perl
3 ccflib 1.1 #
4 ccflib 1.8 # $Id: deleteccf,v 1.7 2020/07/04 11:59:30 ccflib Exp $
5 ccflib 1.1 #
6 ccflib 1.8 # Script to be run from crontab to delete any CCFs in
7     # /home/ccflib/ftp-area/private/ccfdevel/deleted
8 ccflib 1.4
9 ccflib 1.1 require 5;
10     use strict;
11 ccflib 1.8 use warnings;
12 ccflib 1.3 use vars '%ENV';
13 ccflib 1.1
14 ccflib 1.8 # If DEBUG is set, warns without executing
15 ccflib 1.5
16 ccflib 1.8 my $debug = "";
17     if ( $ENV{'DEBUG'} ) {
18     $debug = "$ENV{'DEBUG'}";
19     }
20    
21    
22     my $host=qx/\/bin\/hostname/ ;
23 ccflib 1.5 chomp($host);
24    
25 ccflib 1.8 chdir "/home/ccflib/ccf_ftp/private/ccfdevel/deleted/";
26    
27 ccflib 1.1
28     my $deletes;
29     foreach my $ccf (glob("*.CCF")){
30 ccflib 1.8 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 ccflib 1.1 }
42 ccflib 1.8 if(! $debug && $deletes){
43     print "Script deleteccf running on $host\n";
44     print "Removed CCFs:\n";
45     print " $deletes\n";
46 ccflib 1.3 }

  ViewVC Help
Powered by ViewVC 1.1.27