-
Notifications
You must be signed in to change notification settings - Fork 0
/
backup_elvis_genesis_cyg
executable file
·42 lines (37 loc) · 1.15 KB
/
backup_elvis_genesis_cyg
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
#!/usr/bin/env bash
#
if $(id -G | grep -qE '\<(114|544)\>')
then
echo "running as admin"
else
echo "not admin"
exit 1
fi
SOURCE_VOL=elvis
SOURCE_DRIVE=g
BACKUP_VOL=genesis
BACKUP_DRIVE=f
cd /cygdrive
b_str=$(cat $BACKUP_DRIVE/VOLUME.txt)
s_str=$(cat $SOURCE_DRIVE/VOLUME.txt)
if [ "$s_str" != ${SOURCE_VOL} ]; then
echo "/cygdrive/$SOURCE_DRIVE is not ${SOURCE_VOL} volume, is $s_str"
exit 1
else
echo found ${SOURCE_VOL}
fi
if [ "$b_str" != ${BACKUP_VOL} ]; then
echo "/cygdrive/$BACKUP_DRIVE is not ${BACKUP_VOL} volume, is $b_str"
exit 1
else
echo found ${BACKUP_VOL}
fi
RSYNC_CMD='rsync -av --delete --no-owner --no-group --ignore-errors'
# copy Elvis completely
echo "backup dvd"
${RSYNC_CMD} ${SOURCE_DRIVE}/dvd ${BACKUP_DRIVE}/from_elvis/Elvis | delete_dir_lines_from_rsync echo "backup docs"
${RSYNC_CMD} ${SOURCE_DRIVE}/docs ${BACKUP_DRIVE}/from_elvis/Elvis | delete_dir_lines_from_rsync
echo "backup the from_home dir"
${RSYNC_CMD} -v ${SOURCE_DRIVE}/from_home ${BACKUP_DRIVE}/from_elvis/Elvis | delete_dir_lines_from_rsync
echo "backup itunes"
${RSYNC_CMD} ${SOURCE_DRIVE}/itunes ${BACKUP_DRIVE}/from_elvis/Elvis | delete_dir_lines_from_rsync