Skip to content

Бэкап на Яndex Диск без монтирования davfs

Нашел способ тут

Одна команда
curl -T backup.tar --user логин:пароль https://webdav.yandex.ru

и готово

 

А вот рабочий скрипт бэкапа бд и файлов

cd /var/backup/
date=`date "+%F_%H-%M"`

mysqldump -umegauser -pmegamass -h dbserver --all-databases | gzip -c > "${date}".gz

echo "MySQL backup complete on $date" | mail -s "Backup on $HOSTNAME" root

tar -cPzf exa-and-blog_$date.tar.gz --one-file-system /usr/local/src/exactly/ /usr/local/src/timbadom/blog/
echo "Files backup to harddisk complete on $date" | mail -s "Backup on $HOSTNAME" root

for i in *.gz;
do
curl -T "/var/backup/${i}" -umegauser:megamass https://webdav.yandex.ru
rm ${i}
done

echo "Files backup put to cloud and removed from harddisk" | mail -s "Backup on $HOSTNAME" root

Leave a Reply

Your email address will not be published. Required fields are marked *

π