1 |
#! /usr/local/bin/perl -w |
#! /usr/local/bin/perl -w |
2 |
# |
# |
3 |
# Giuseppe Vacanti (cosine science & computing bv) |
# $Id: deleteccf,v 1.4 2013/02/14 14:26:44 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 |
|
# It is intended to be run by a crontab, either on xvsoc01 or in sasbld01 |
7 |
|
|
8 |
require 5; |
require 5; |
9 |
use strict; |
use strict; |
10 |
use lib "/data/xmm/ccflib/cgi"; |
use vars '%ENV'; |
11 |
use vars '%Env'; |
use lib "$ENV{'HOME'}/cgi"; |
12 |
$Env{'PATH'} .= "/data/xmm/ccflib/bin:"; |
$ENV{'PATH'} .= "$ENV{'HOME'}/bin:"; |
13 |
use Ccflib; |
|
14 |
|
# Can not use Ccflib.pm located in $HOME/cgi because it has definitions for directories only on xvsoc01. |
15 |
|
# use Ccflib; |
16 |
|
|
17 |
|
my $host=qx/hostname | cut -d. -f1/ ; |
18 |
|
my $homedir="/home/ccflib" ; |
19 |
|
chomp($host); |
20 |
|
$homedir="/data/xmm/ccflib" if ( $host eq "xvsoc01" ) ; |
21 |
|
|
22 |
chdir $Ccflib::develrm or die("Cannot access $Ccflib::develrm\n"); |
chdir "$homedir/ftp-area/private/ccfdevel/deleted/" ; |
23 |
|
|
24 |
my $deletes; |
my $deletes; |
25 |
foreach my $ccf (glob("*.CCF")){ |
foreach my $ccf (glob("*.CCF")){ |
30 |
$deletes .= "$ccf "; |
$deletes .= "$ccf "; |
31 |
} |
} |
32 |
} |
} |
33 |
|
if($deletes){ |
34 |
|
print "The following constituents were found in the removed subdirectory:\n"; |
35 |
|
print "$deletes\n"; |
36 |
|
print "Now they have been definetely erased.\n"; |
37 |
|
} |
38 |
|
|
39 |
|
##my $x = qx/ccfnotify -t development -d $deletes/; |
40 |
|
## |
41 |
|
##if(! $? >> 8){ |
42 |
|
## warn("Notification failed\n"); |
43 |
|
##} |
44 |
|
|
45 |
|
|
46 |
|
|
|
my $x = qx/ccfnotify -t development -d $deletes/; |
|
47 |
|
|
|
if(! $? >> 8){ |
|
|
warn("Notification failed\n"); |
|
|
} |
|
48 |
|
|
49 |
|
|