Update docker1-backup.sh
This commit is contained in:
parent
f8f29dcd2f
commit
52d78f02b3
1 changed files with 8 additions and 10 deletions
|
@ -6,31 +6,29 @@ backupDate=$(date +'%F')
|
||||||
# this just prints the formated date variable to the console if you want to see it.
|
# this just prints the formated date variable to the console if you want to see it.
|
||||||
echo $backupDate
|
echo $backupDate
|
||||||
|
|
||||||
# move to the path where you will keep all of yoru docker configurations and data
|
|
||||||
cd /docker
|
|
||||||
|
|
||||||
# stop ALL containers
|
# stop ALL containers
|
||||||
docker stop $(docker ps -a -q)
|
docker stop $(docker ps -a -q)
|
||||||
|
|
||||||
cd /home/debian/backup
|
# enter backup directory
|
||||||
#create a tar archive of your docker parent folder
|
cd /home/rob/docker/backup
|
||||||
tar --exclude='./backup/' -czvf $backupDate-backup-docker2.tar.gz /docker
|
|
||||||
|
#create a tar archive of your docker parent folder
|
||||||
|
tar --exclude='./backup/' -czvf $backupDate-backup-docker1.tar.gz /home/rob/docker # dir to backup
|
||||||
|
|
||||||
cd /docker
|
|
||||||
|
|
||||||
#Start ALL containers
|
#Start ALL containers
|
||||||
docker start $(docker ps -a -q)
|
docker start $(docker ps -a -q)
|
||||||
|
|
||||||
# now go back to backup directory, and copy my backup file to my NAS
|
# now go back to backup directory, and copy my backup file to my NAS
|
||||||
cd /home/debian/backup
|
cd /home/rob/docker/backup
|
||||||
echo ""
|
echo ""
|
||||||
echo "Backup copy is running..."
|
echo "Backup copy is running..."
|
||||||
|
|
||||||
# use secure copy to copy the tar archive to your final backup location (in my case a mounted NFS share)
|
# use secure copy to copy the tar archive to your final backup location (in my case a mounted NFS share)
|
||||||
rclone copy $backupDate-backup-docker2.tar.gz b2:server-backup-rgm --progress
|
rclone copy $backupDate-backup-docker1.tar.gz b2:rgm-docker1 --progress
|
||||||
|
|
||||||
# remove the tar file from the main home folder after it's copied
|
# remove the tar file from the main home folder after it's copied
|
||||||
rm -rf $backupDate-backup-docker2.tar.gz
|
rm -rf $backupDate-backup-docker1.tar.gz
|
||||||
|
|
||||||
echo "Local backup file removed..."
|
echo "Local backup file removed..."
|
||||||
echo "Docker Backup Completed Successfully!"
|
echo "Docker Backup Completed Successfully!"
|
||||||
|
|
Loading…
Reference in a new issue