1 |
#! /usr/local/bin/perl -w |
#! /xdata/ccflib/perl5/perlbrew/perls/perl-5.18.4/bin/perl -w |
2 |
# |
# |
3 |
# Giuseppe Vacanti (cosine science & computing bv) |
# $Id: deleteccf,v 1.6 2018/01/15 10:02:11 ccflib Exp $ |
|
# |
|
|
# $Id: deleteccf,v 1.1 2002/03/18 18:28:57 ccflib Exp $ |
|
4 |
# |
# |
5 |
|
# This script simply deletes all CCFs put in the subdir ccfdev/deleted. |
6 |
|
|
7 |
require 5; |
require 5; |
8 |
use strict; |
use strict; |
9 |
use lib "/data/xmm/ccflib/cgi"; |
use vars '%ENV'; |
10 |
use vars '%Env'; |
use lib "$ENV{'HOME'}/cgi"; |
11 |
$Env{'PATH'} .= "/data/xmm/ccflib/bin:"; |
$ENV{'PATH'} .= "$ENV{'HOME'}/bin:"; |
12 |
use Ccflib; |
|
13 |
|
|
14 |
|
my $host=qx/\/bin\/hostname | cut -d. -f1/ ; |
15 |
|
my $homedir="/home/ccflib" ; |
16 |
|
chomp($host); |
17 |
|
|
18 |
chdir $Ccflib::develrm or die("Cannot access $Ccflib::develrm\n"); |
chdir "$homedir/ftp-area/private/ccfdevel/deleted/" ; |
19 |
|
|
20 |
my $deletes; |
my $deletes; |
21 |
foreach my $ccf (glob("*.CCF")){ |
foreach my $ccf (glob("*.CCF")){ |
22 |
qx/rm -f $ccf/; |
qx/rm -f $ccf/ if ($ccf); |
23 |
if(! $? >> 8){ |
if(! $? >> 8){ |
24 |
warn("Deletion of $ccf failed\n"); |
warn("Deletion of $ccf failed\n"); |
25 |
} else { |
} else { |
26 |
$deletes .= "$ccf "; |
$deletes .= "$ccf "; |
27 |
} |
} |
28 |
} |
} |
29 |
|
if($deletes){ |
30 |
my $x = qx/ccfnotify -t development -d $deletes/; |
print "The following constituents were found in the removed subdirectory:\n"; |
31 |
|
print "$deletes\n"; |
32 |
if(! $? >> 8){ |
print "Now they have been definetely erased.\n"; |
|
warn("Notification failed\n"); |
|
33 |
} |
} |
34 |
|
|
35 |
|
##my $x = qx/ccfnotify -t development -d $deletes/; |
36 |
|
## |
37 |
|
##if(! $? >> 8){ |
38 |
|
## warn("Notification failed\n"); |
39 |
|
##} |