forked from deapplegate/wtgpipeline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
backup_rings.sh
executable file
·43 lines (26 loc) · 948 Bytes
/
backup_rings.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
subaru=/nfs/slac/g/ki/ki05/anja/SUBARU
clusters=`ls ${subaru}`
curdate=`date +%y-%m-%d_%H-%M`
backupdir=${subaru}/rings_backup_${curdate}
if [ -d ${backupdir} ]; then
echo "Backup Dir Exists!?"
exit 1
fi
mkdir ${backupdir}
for cluster in $clusters; do
filters=`ls ${subaru}/${cluster}`
for filter in $filters; do
if [ -d ${subaru}/${cluster}/${filter}/SCIENCE/ ]; then
suppressiondirs=`ls ${subaru}/${cluster}/${filter}/SCIENCE/ | grep suppression`
for suppressiondir in ${suppressiondirs}; do
if [ -d ${subaru}/${cluster}/${filter}/SCIENCE/${suppressiondir} ]; then
mkdir -p ${backupdir}/${cluster}/${filter}
cp -r ${subaru}/${cluster}/${filter}/SCIENCE/${suppressiondir} ${backupdir}/${cluster}/${filter}/${suppressiondir}
fi
done
fi
done
done
tar -zcvf ${subaru}/rings_backup_${curdate}.tar.gz ${backupdir}
chmod 444 ${subaru}/rings_backup_${curdate}.tar.gz