-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfolder_backuper.sh
More file actions
executable file
·46 lines (40 loc) · 1.98 KB
/
folder_backuper.sh
File metadata and controls
executable file
·46 lines (40 loc) · 1.98 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
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
function bitrix_folder_backup(){
NAME=getNeedValue $1 "bitrix"
NEED_FOLDER=getNeedValue $2 "./"
cd ${NEED_FOLDER}
tar --exclude "./bitrix/tmp/*" --exclude "./bitrix/cache/*" --exclude "./bitrix/managed_cache/*" --exclude "./bitrix/stack_cache/*" --exclude "./bitrix/html/*" --exclude "*.tar" --exclude "*.gz" --exclude "*.sql" -czf ./${NAME}.tar.gz ./bitrix
}
function upload_folder_backup(){
NAME=getNeedValue $1 "upload"
NEED_FOLDER=getNeedValue $2 "./"
cd ${NEED_FOLDER}
tar --exclude "./upload/tmp/*" --exclude "./upload/resize_cache/*" --exclude "*.tar" --exclude "*.gz" --exclude "*.sql" -czf ./upload.tar.gz ./upload
}
function full_folder_backup(){
NAME=getNeedValue $1 "site"
NEED_FOLDER=getNeedValue $2 "./"
cd ${NEED_FOLDER}
tar --exclude "./bitrix/tmp/*" --exclude "./bitrix/cache/*" --exclude "./bitrix/managed_cache/*" --exclude "./bitrix/stack_cache/*" --exclude "./bitrix/html/*" --exclude "./upload/tmp/*" --exclude "./upload/resize_cache/*" --exclude "*.tar" --exclude "*.gz" --exclude "*.sql" -czf ./site.tar.gz ./
}
function full_without_upload_folder_backup(){
NAME=getNeedValue $1 "site_without_upload"
NEED_FOLDER=getNeedValue $2 "./"
cd ${NEED_FOLDER}
tar --exclude "./bitrix/tmp/*" --exclude "./bitrix/cache/*" --exclude "./bitrix/managed_cache/*" --exclude "./bitrix/stack_cache/*" --exclude "./bitrix/html/*" --exclude "./upload/*" --exclude "*.tar" --exclude "*.gz" --exclude "*.sql" -czf ./site_without_upload.tar.gz ./
}
function full_without_bitrix_upload_folder_backup(){
NAME=getNeedValue $1 "site_without_bitrix_upload"
NEED_FOLDER=getNeedValue $2 "./"
cd ${NEED_FOLDER}
tar --exclude "./bitrix/*" --exclude "./upload/*" --exclude "*.tar" --exclude "*.gz" --exclude "*.sql" -czf ./site_without_bitrix_upload.tar.gz ./
}
function getNeedValue(){
CHECK_VALUE=$1
DEFAULT_VALUE=$2
if [[ -n $CHECK_VALUE ]]; then
echo $CHECK_VALUE
else
echo $DEFAULT_VALUE
fi
}