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$ |
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 |
|
26 |
for file in `ls -1tr *xmm-newton.cif` |
27 |
do |
28 |
registered=`grep -c "$file" DELIVERY_LOG` |
29 |
[ "$registered" = "1" ] && continue |
30 |
mtime=`stat --printf=%y $file | awk -F"." '{print $1}'` |
31 |
printf "%-40s %-10s %-10s\n" $file $mtime |
32 |
done >> /home/ccflib/ftp-area/download/DELIVERY_LOG |
33 |
|
34 |
# 3) Runs on xvsoc01 through ssh the clean_cif_files and clean_uploaded_files scripts |
35 |
|
36 |
ssh ccflib@xmm.esac.esa.int "/data/xmm/ccflib/bin/clean_cif_files" |
37 |
ssh ccflib@xmm.esac.esa.int "/data/xmm/ccflib/bin/clean_uploaded_files" |
38 |
|
39 |
# 4) Cleans up any *.cif files older than 24hrs |
40 |
|
41 |
find /home/ccflib/ftp-area/download/ -type f -name "*.cif" -mtime +1 -exec rm {} \; |
42 |
|