Skip to content

Instantly share code, notes, and snippets.

@clintkev251
Created July 28, 2022 00:06
Show Gist options
  • Save clintkev251/0bfcc4e7e552addc14084b9faf4de1ba to your computer and use it in GitHub Desktop.
Save clintkev251/0bfcc4e7e552addc14084b9faf4de1ba to your computer and use it in GitHub Desktop.
Generic backup script which stops and restarts containers
#!/bin/bash
echo "-----Stopping containers-----"
docker stop $(docker ps -q)
echo "-----Creating archive-----"
tar -cf stacks.tar stacks
echo "-----Restarting containers-----"
docker start $(docker ps -a -q)
echo "-----Uploading backup-----"
rclone sync stacks.tar backblaze:some-bucket
echo "-----Upload complete, cleaning up-----"
rm stacks.tar
curl https://status.example.com/api/push/example?status=up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment