Implement archiving and rsync placeholder
This commit is contained in:
parent
6ffbc54ea0
commit
0b425f5687
@ -4,6 +4,7 @@
|
||||
# Please double check Your settings
|
||||
# --------------------------------------------------------
|
||||
|
||||
enabled=false #enable main function
|
||||
|
||||
www_backup=false # backup wwwroot
|
||||
www_dir='xyz' # wwwroot location
|
||||
@ -17,6 +18,8 @@ apache=false # apache log backup
|
||||
nginx=false # nginx log backup
|
||||
log_purge=false # purge logs after backup
|
||||
|
||||
rsync_push=false # enable push to remote server
|
||||
push_clean=false # clean backup file after push
|
||||
#Docker
|
||||
#Docker volumes
|
||||
#Syslogs
|
||||
|
38
main.sh
38
main.sh
@ -23,8 +23,9 @@ source "$config"
|
||||
echo "Configuration file loaded" >&2
|
||||
|
||||
function makedir {
|
||||
mkdir /tmp/backify-$(date +%Y%m%d_%H%M)
|
||||
tmpdir='/tmp/backify-$(date +%Y%m%d_%H%M)'
|
||||
timestamp=$(date +%Y%m%d_%H%M)
|
||||
mkdir /tmp/backify-timestamp
|
||||
tmpdir='/tmp/backify-timestamp'
|
||||
}
|
||||
|
||||
function wwwbackup {
|
||||
@ -78,15 +79,32 @@ if [ "$log_backup" = true ] then
|
||||
fi
|
||||
}
|
||||
|
||||
function push {
|
||||
if [ "rsync_push" = true ] then
|
||||
#Push
|
||||
if [ "push_clean" = true ] then
|
||||
rm /opt/backify-$timestamp.tar.gz
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function runbackup {
|
||||
# step 1 : create directory
|
||||
makedir
|
||||
# step 2 : wwwbackup
|
||||
wwwbackup
|
||||
# step 3 : vhostbackup
|
||||
vhostbackup
|
||||
# step 4: logbackup
|
||||
logbackup
|
||||
if [ "enabled" = true] then
|
||||
# step 1 : create directory
|
||||
makedir
|
||||
# step 2 : wwwbackup
|
||||
wwwbackup
|
||||
# step 3 : vhostbackup
|
||||
vhostbackup
|
||||
# step 4: logbackup
|
||||
logbackup
|
||||
# archive data
|
||||
echo "Creating backup archive..." >&2
|
||||
tar -czvf /opt/backify-$timestamp.tar.gz $tmpdir
|
||||
# push data to server
|
||||
push
|
||||
echo "Voila, enjoy the rest of the day" >&2
|
||||
fi
|
||||
}
|
||||
|
||||
runbackup
|
Loading…
Reference in New Issue
Block a user