1 |
#! /xdata/ccflib/perl5/perlbrew/perls/perl-5.18.4/bin/perl -w |
#! /xdata/ccflib/perl5/perlbrew/perls/perl-5.18.4/bin/perl -w |
2 |
# |
# |
3 |
# $Id: deleteccf,v 1.5 2014/12/02 14:06:51 ccflib Exp $ |
# $Id: deleteccf,v 1.6 2018/01/15 10:02:11 ccflib Exp $ |
4 |
# |
# |
5 |
# This script simply deletes all CCFs put in the subdir ccfdev/deleted. |
# This script simply deletes all CCFs put in the subdir ccfdev/deleted. |
|
# It is intended to be run by a crontab, either on xvsoc01 or in sasbld01 |
|
6 |
|
|
7 |
require 5; |
require 5; |
8 |
use strict; |
use strict; |
10 |
use lib "$ENV{'HOME'}/cgi"; |
use lib "$ENV{'HOME'}/cgi"; |
11 |
$ENV{'PATH'} .= "$ENV{'HOME'}/bin:"; |
$ENV{'PATH'} .= "$ENV{'HOME'}/bin:"; |
12 |
|
|
|
# Can not use Ccflib.pm located in $HOME/cgi because it has definitions for directories only on xvsoc01. |
|
|
# use Ccflib; |
|
13 |
|
|
14 |
my $host=qx/\/bin\/hostname | cut -d. -f1/ ; |
my $host=qx/\/bin\/hostname | cut -d. -f1/ ; |
15 |
my $homedir="/home/ccflib" ; |
my $homedir="/home/ccflib" ; |
16 |
chomp($host); |
chomp($host); |
|
$homedir="/data/xmm/ccflib" if ( $host eq "xvsoc01" ) ; |
|
17 |
|
|
18 |
chdir "$homedir/ftp-area/private/ccfdevel/deleted/" ; |
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 { |
37 |
##if(! $? >> 8){ |
##if(! $? >> 8){ |
38 |
## warn("Notification failed\n"); |
## warn("Notification failed\n"); |
39 |
##} |
##} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|