-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbackup.sh
More file actions
executable file
·33 lines (29 loc) · 1.13 KB
/
backup.sh
File metadata and controls
executable file
·33 lines (29 loc) · 1.13 KB
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
#!/bin/bash
LOCK=~/.backup_lock
if ! mkdir $LOCK 2> /dev/null; then
echo "backup script is already running"
exit 1
fi
TMP=`mktemp`;
if mountpoint -q "/mount/limr/zedshared/"; then
echo "searching for files in /ifs/e63data/reis-filho/"
cd /ifs/e63data/reis-filho/ && \
find data projects -type d \
\( -name bam -o -name tables -o -name alltables -o -name vcf \) \
! -path "*/log/*" ! -path "*/tmap/*" ! -path "*/gatk/*" ! -path "*/hydra/*" ! -path "*/bwa/*" \
! -path "*/varscan/*" ! -path "*/mutect/*" ! -path "*/scalpel/*" ! -path "*/som_sniper/*" ! -path "*/rawdata/*" \
! -path "*/unprocessed_bam/*" ! -path "*/defuse/*" ! -path "*/chimscan/*" -print0 > ${TMP}
while [ 1 ]; do
cd /ifs/e63data/reis-filho/ && \
rsync --verbose --checksum --progress --stats --recursive --append --partial -a -0 --files-from=${TMP} --prune-empty-dirs ./ /mount/limr/zedshared
if [ "$?" = "0" ]; then
echo "rsync complete"
exit
else
echo "rsync failure, retrying in 1 minute..."
sleep 60
fi
done
rm ${TMP}
fi
rmdir $LOCK