Implement archiving and rsync placeholder

This commit is contained in:
gospodar 2023-02-10 16:36:51 +01:00
parent 6ffbc54ea0
commit 0b425f5687
2 changed files with 31 additions and 10 deletions

View File

@ -4,6 +4,7 @@
# Please double check Your settings # Please double check Your settings
# -------------------------------------------------------- # --------------------------------------------------------
enabled=false #enable main function
www_backup=false # backup wwwroot www_backup=false # backup wwwroot
www_dir='xyz' # wwwroot location www_dir='xyz' # wwwroot location
@ -17,6 +18,8 @@ apache=false # apache log backup
nginx=false # nginx log backup nginx=false # nginx log backup
log_purge=false # purge logs after 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
#Docker volumes #Docker volumes
#Syslogs #Syslogs

38
main.sh
View File

@ -23,8 +23,9 @@ source "$config"
echo "Configuration file loaded" >&2 echo "Configuration file loaded" >&2
function makedir { function makedir {
mkdir /tmp/backify-$(date +%Y%m%d_%H%M) timestamp=$(date +%Y%m%d_%H%M)
tmpdir='/tmp/backify-$(date +%Y%m%d_%H%M)' mkdir /tmp/backify-timestamp
tmpdir='/tmp/backify-timestamp'
} }
function wwwbackup { function wwwbackup {
@ -78,15 +79,32 @@ if [ "$log_backup" = true ] then
fi fi
} }
function push {
if [ "rsync_push" = true ] then
#Push
if [ "push_clean" = true ] then
rm /opt/backify-$timestamp.tar.gz
fi
fi
}
function runbackup { function runbackup {
# step 1 : create directory if [ "enabled" = true] then
makedir # step 1 : create directory
# step 2 : wwwbackup makedir
wwwbackup # step 2 : wwwbackup
# step 3 : vhostbackup wwwbackup
vhostbackup # step 3 : vhostbackup
# step 4: logbackup vhostbackup
logbackup # 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 runbackup