A bash script to backup mastodon server data, when running it with docker compose
| backup.sh | ||
| README.md | ||
Mastodon backup.sh
This is a shell script that can be dropped into folder for a mastodon server, running inside of docker compose.
Setup
Before you use this script, you will need to fill out a few variables at the top of the script.
pod: the name for the folder that the script is in, and that docker compose uses for the machine names
You'll also need to create the following directories:
backups: the folder where all of the local backups will be storedbackups/daily: used for daily backups, stores 7 backups, or one weekbackups/manual: used for manual backups, whenever you run the scriptbackups/monthly: used for monthly backups, stores 12 backups, or one yearbackups/weekly: used for weekly backups, stores 5 backups, or one monthbackups/working: used as the working directory for current operation
Running
Add to Crontab
Add the following line to your crontab, replacing
/home/developer/containers/mastodon/pandapla.net with the location of your
container data.
0 4 * * * cd /home/developer/containers/mastodon/pandapla.net && ./backup.sh
Running Manually
If you'd like to make a manual backup, just go to the directory and run the
script with ./backup.sh. When run manually, the backup is stored in the
backups/manual folder, and are kept until you remove them.