-
Notifications
You must be signed in to change notification settings - Fork 23
/
Gdrivebackup.sh
executable file
·32 lines (24 loc) · 1.24 KB
/
Gdrivebackup.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
#!/bin/bash
###
### This script is to zip and save certain directories from Google Drive which have been backed up to 'ngi.transfer' to the homer system for QA purposes
### This script requires that The Google Backup and Sysnc utility be running on the ngi.transfer computer and that ngi.transfer has access to homer
### Recommended to be run once a month. The file `~/Library/Preferences/nsmb.conf` contains the password details for mount_smbfs.
###
currentDate=`date +"%Y-%m-%d"`
echo 'Run $currentDate'
GDRIVE="$HOME/Google Drive/My Drive"
#Zip GDrive Sync file
zip -vr $HOME/opt/zipFilesTemp/QAbackup.$currentDate.zip $GDRIVE/Electronic\ logbooks\ \(QA\ system\) \
$GDRIVE/Genomics\ Platform $GDRIVE/_Quality\ assurance\ system
#make mountpoint
mkdir -p $HOME/kvalitetssystem
#export the password from the file `~/Library/Preferences/nsmb.conf`
export $(sed -n 2p /Users/ngi.transfer/Library/Preferences/nsmb.conf)
#Mount homer
/sbin/mount -t smbfs //ngi.transfer:[email protected]/kvalitetssystem $HOME/kvalitetssystem
#Copy zipped backup file
rsync -av $HOME/opt/zipFilesTemp/QAbackup.$currentDate.zip $HOME/kvalitetssystem
#Unmount homer
/sbin/umount $HOME/kvalitetssystem
#rm zip file
rm $HOME/opt/zipFilesTemp/QAbackup.$currentDate.zip