-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbackup.sh
executable file
·57 lines (45 loc) · 943 Bytes
/
backup.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
# source 'script' functions
. $(dirname $0)/common/source.sh
# source common scripts
source_common
# update the repo
update_repo
LIST="
/etc/apache2
/etc/crontab
/etc/screenrc
/etc/letsencrypt
/etc/monit
/etc/transmission-daemon
/root
/home
/var/lib/transmission-daemon/.config/transmission-daemon
/var/www
"
EXCLUDE="
builds/full
zvikovincent
AOSPA
dotOS
DotOS
LineageOS
LineageOS_Go
MindTheGApps
OpenGApps
ResurrectionRemix
TWRP
.vim
.cache
.local
.jenkins
"
TEMP_DIR=$(mktemp -d)
EXCLUSIONS_FILE=${TEMP_DIR}/exclusions.txt
echo "$EXCLUDE" > ${EXCLUSIONS_FILE}
BACKUP_NAME=${TEMP_DIR}/"backup-$(date +%d-%m-%Y-%H%M).tar.gz"
TAR=$(which tar)
TAR_OPTS="-cvz --exclude-vcs --exclude-from=${EXCLUSIONS_FILE} -f ${BACKUP_NAME} ${LIST}"
${TAR} ${TAR_OPTS} | tee ${BACKUP_NAME}.list
ssh jenkins@msm8916.com "mkdir /backups/$(hostname) -p" && scp ${BACKUP_NAME}* jenkins@msm8916.com:/backups/$(hostname)/
rm -rf ${TEMP_DIR}