I wrote a very small python script that works in conjunction with another MySQL backup script to sync your backup on the Yandex disk service.
First, in order to do this, you should have a Yandex client installed. You can get the packages from the Yandex repo at http://repo.yandex.ru/yandex-disk/ .
More specific in Debian/ubuntu case just do a:
After that install the Yandex Console client as usual doing:
After installing the package, basic Yandex commands should be available(commands like yandex-disk start, yandex-disk sync, and others).
The script uses the yandex-disk commands.
Next, you should set up your Yandex client with the command Yandex setup.
After the Yandex setup command, you should place both the Yandex script and the MySQL script you can download the Mysql Backup script from GitHub with:
(Anyway I will provide a download link for both scripts later just in case the previous link will not work anymore.)
The Yandex Backup script is as following:( I should note that in case that the Yandex token will expire the script will make a new token using your credentials. Also is important that you change all variables from the script according to your case.)
After that you should place a CRON entry, I recommend one that executes weekly.
You should be aware that the Yandex script uses python3 syntax so your system should have python3 installed in order to properly work. But most new distros even the ones on LTS have python3 support.
I use the following crontab entry:
@weekly andrei /home/andrei/yandex_backup/bkscripts/YandexMBKS.py
Don't forget to grant executable rights to both script files using chmod +x.
Practically the whole idea of the script is to not keep yandex-disk daemon on, just use the sync once a week then to stop the daemon. I am pretty sure that a lot of improvements can be made to the script but I just want to write one that does the job.
Almost forgot here is a link to an archive with both scripts: