/[CCFs]/bin/cif_manager
ViewVC logotype

Contents of /bin/cif_manager

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations)
Mon Apr 11 08:28:28 2016 UTC (8 years, 7 months ago) by ccflib
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +12 -10 lines
Added checking the existence of xmm-newton.cif files in /lhome/ccflib/ftp-area/download so as the ls is ok when starting the for

1 #! /bin/bash
2 #
3 # cif_manager
4 #
5 # This script does the following operations in sequence:
6 # 1) Gets the latest cif files created in the ftp-area/download subdirectory of ccflib
7 # on xvsoc01 by the cifbuild on-line tool included in the calibration section of web page
8 # 2) Registers any new *xmm-newton.cif files in the DELIVERY_LOG
9 # 3) Runs on xvsoc01 the scripts clean_cif_files and clean_uploaded_files
10 # to remove any *xmm-newton.cif and *uploaded.cif files older than 24 hrs
11 # 4) Cleans up the local ftp-area/download directory of any *.cif files older than 24 hrs.
12 #
13 # This script is run 15 min after the hour for all hours of day by cron.
14 #
15 # $Id: cif_manager,v 1.3 2015/03/09 10:01:59 ccflib Exp $
16
17
18 # 1) Synchronizes both directories
19
20 rsync -a -e ssh ccflib@xmm.esac.esa.int:/data/xmm/ftp/pub/ccf/download/ \
21 /home/ccflib/ftp-area/download/
22
23
24 # 2) Registers any new file in DELIVERY_LOG
25 therearefiles=`ls -1tr /home/ccflib/ftp-area/download | grep -c xmm-newton.cif`
26 if [ "$therearefiles" != "0" ] ; then
27 for file in `ls -1tr /home/ccflib/ftp-area/download/*xmm-newton.cif`
28 do
29 filebase=`basename $file`
30 registered=`grep -c "$filebase" /home/ccflib/ftp-area/download/DELIVERY_LOG`
31 [ "$registered" = "1" ] && continue
32 mtime=`stat --printf=%y $file | awk -F"." '{print $1}'`
33 printf "%-40s %-10s %-10s\n" $filebase $mtime
34 done >> /home/ccflib/ftp-area/download/DELIVERY_LOG
35 fi
36
37 # 3) Runs on xvsoc01 through ssh the clean_cif_files and clean_uploaded_files scripts
38
39 ssh ccflib@xmm.esac.esa.int "/data/xmm/ccflib/bin/clean_cif_files"
40 ssh ccflib@xmm.esac.esa.int "/data/xmm/ccflib/bin/clean_uploaded_files"
41
42 # 4) Cleans up any *.cif files older than 24hrs
43
44 find /home/ccflib/ftp-area/download/ -type f -name "*.cif" -mtime +1 -exec rm {} \;
45

  ViewVC Help
Powered by ViewVC 1.1.27