Docs/MirroringStdAncilFiles: sync_ancil

File sync_ancil, 1.1 KB (added by willie, 3 months ago)

ARCHER script to synch RDF shared account ancils to Lustre file system

Line 
1#!/bin/ksh --login
2#
3# Synchronise the umshared account ancils with Willie's
4# shared directory /nerc/n02/shared/ancil
5#
6# Run from $HOME/temp so the log file goes there.
7#
8#PBS -l select=serial=true:ncpus=1
9#PBS -l walltime=10:00:00
10#PBS -A y07
11#PBS -N sync_ancil
12#PBS -W umask=0022
13#PBS -j oe
14#PBS -m ae
15#PBS -M w.mcginty@reading.ac.uk
16
17
18NOW=$(date -u)
19
20# Make sure any symbolic links are resolved to absolute path
21export PBS_O_WORKDIR=$(readlink -f $PBS_O_WORKDIR)
22
23# Change to the directory that the job was submitted from
24cd $PBS_O_WORKDIR
25
26#Create a temporary file
27TMPFILE=$(mktemp --tmpdir=$HOME/temp)
28
29time -p rsync -av --stats /nerc/n02/shared/ancil/ \
30                   /work/y07/y07/umshared/ancil > $TMPFILE 2>&1
31RC=$?
32if (( RC != 0 ))
33then
34 echo "Rsync to umshared failed."
35 echo "return code $RC"
36else
37 echo "Rsync to umshared succeeded."
38 cat $TMPFILE
39# Summarise the transfer
40 ~wmcginty/bin/xfer_rate2 $TMPFILE
41  rm $TMPFILE
42fi
43
44NEXT=$(date -u -d "$NOW +7 days" "+%Y%m%d")
45
46qsub -a ${NEXT}1930 $HOME/temp/sync_ancil
47
48#Delete very old log files
49AGE=42 # days
50find $HOME/temp -name "sync_ancil.o*" -mtime +$AGE -exec rm {} \;
51
52return $RC