Backupninja allows you to coordinate system backup by dropping a few simple configuration files into /etc/backup.d/. Most programs you might use for making backups don’t have their own configuration file format. Backupninja provides a centralized way to configure and coordinate many different backup utilities.
Install the backupninja
To install backupninja, you need to log into your server and issue the following commands:
Ubuntu / Debian
apt update -y
apt install backupninja
RHEL & Centos
dnf install epel-release
dnf install backupninja duplicity rdiff-backup
Configuring Backupninja
The backupninja application comes with a handy wizard that will help you set up your backup.
# ninjahelper

MySQL backup
Choose to create a new backup action and MySQL database backup.
Next, you need to enter a directory.
If you need to backup all databases, click YES, otherwise, you have to enter the name of the database to back up.
Set up authentication method, I will choose a password.
Select backup option by spacebar.
Done, the MySQL backup is configured.
Now you can view, edit, disable, rename, run, test, or delete config.

Folder Backup
I ran several websites on the server, so I want to keep website files safe, so I need to create a new backup rule. In my case, I will choose a TAR backup.
Name needed and path for backup.
On the next pages, you should enter Includes/Excludes.
Done, the backup is configured.
Automate backups
I will simply add to my cron the next row, so the backup could start every 2 a.m.
0 2 * * * /usr/sbin/backupninja --now
Remove files from backup
Tar backups by default does not have a rotation so you should add the next script to cron to remove files older than 14 days
0 1 * * * find /path/to/backup/* -type f -mtime +14 -exec rm -f {} \;