- Python 100%
| .gitignore | ||
| LICENSE | ||
| main.py | ||
| README.md | ||
Rclone-Backuper
This script reads a list of directories, compresses each one, then copies them to each rclone remote specified.
Theres also an option to stop all docker containers with a specific label, then restarting them after the backup finishes.
The compressed archives are saved as PARENTDIR-DIR.tar.gz
Recommended to run the script periodically (with a cron job or a systemctl service)
Supported Python Versions: 3.6+
Requirements: No Python libraries, rclone installed and available. tar installed and available. docker only needed if stopping containers (or you can specify your own container runner)
Configuration
Make a directory in this script's location with the name conf
The script reads conf/directories.list, conf/excludes.list, and conf/remotes.list
Lines starting with # are ignored
directories.list
The list of directories to compress and backup. Absolute paths are recommended. (Note: make sure the user running the script has full permissions for these directories)
# Example directories.list
/home/user/Documents
/home/user/Pictures
/mnt/Drive
remotes.list
The list of rclone remotes to backup to.
# Example remotes.list
google-drive:
backblaze:Backup
hddcrypt:Server/Backup
excludes.list
The list of files/directories to exclude, used by tar.
The script's temp and log directory are automatically exlcuded.
# Example excludes.list
/home/user/Downloads
/home/user/Projects/*/venv
*/.var/app/com.valvesoftware.Steam/data/*
Environment Variables
(note: the script doesnt read .env files)
DRY_RUN- If set totrue, adds the--dry-runparameter to the rclone copy command (Default:false)STOP_CONTAINERS- If set totrue, will stop all containers before the backup, then restart them after. (Default:false)STOP_CONTAINERS_LABEL- If set, andSTOP_CONTAINERSis on, wlll only stop containers with this label. Otherwise, stop all containers.DOCKER_EXECUTABLE- The executable to use for managing containers, override to use a different container runtime, must be compatiable with docker stop, ps, restart commands. (eg. podman) (Default:docker)RCLONE_TRANSFERS- Sets the--transfersparameter on the rclone command for faster speeds. (Default:16)SUBPROCCESS_TIMEOUT- Sets the timeout for subproccesses (For things like compressing and rclone). Set to -1 for no timeout. (Default:3600)STREAM_LOG_LEVEL- Sets the logging level for the console (Default:INFO)FILE_LOG_LEVEL- Sets the logging level for the logfile (Default:DEBUG)