My attempt was to create a simple and secure remote backup script. Right now it only works with MySql (or MariaDB).


This script will halt and exit immediately after any failed commands.

There are a lot of bad coding practices found with many bash scripts on the internet. There is a short list of good coding practices at the blog of Kevin van Zonneveld. Bash3boilerplate is a fantastic starter bootstrap for bash scripts with ideal code for any bash script. This backup script utilizes this template.


Version: 0.1 Release Notes



I avoid hardcoding login/auth credentials. Not only does this keep you from accidentally making a commit with your credentials, it keeps the script portable.

This script only works with private/public key pairs, and it only connects to servers whose fingerprints are known (typically these are hosts in ~/.ssh/known_hosts)


Important Notes

It assumes you are using public/private keys for authentication via SSH.

It assumes you have user-specific mysql configuration. Such as the following ~/.my.cnf file.


Example command:

The default port is 22 if not specified -c -p 2121 -r /path/to/backup -m -b dbname

This can be ran via cron jobs.

Execute: help

To see a list of options.