Good day.
There is a script to backup MySQL databases and upload to Yandex disk:
#/usr/bin/bash # шифрование файла GPG_COMMAND="gpg -c -z 0 --no-batch --passphrase 123" MYSQL_FILE=database_backup_`date +%d_%m_%Y_%H_%M_%S`.sql.gz.gpg # бэкап бд mysqldump -u root -padmin --events --ignore-table=mysql.event -h 127.0.0.1 --all-databases | gzip | $GPG_COMMAND> /var/www/mysql_backups/$MYSQL_FILE # если бэкап не создался if [ ${PIPESTATUS[0]} -ne "0" ] then echo ERROR MYSQL DUMP # отправить смс curl -d "text=Error backup all-databases." http://sms.ru/sms/send\?api_id=11111-5A6D-34545-CE5E-111\&to=380631111111 # отправить эл. письмо echo "Error backup all-databases." | mail -s "Error mysql dump" example@example.ru exit 1 else echo GOOD MYSQL DUMP # отправить с помощью curl на яндекс диск и записать статус в RESPONSE_STATUS RESPONSE_STATUS=$(curl --user login:password -T /var/www/mysql_backups/$MYSQL_FILE https://webdav.yandex.ru/backup_ubuntu_mysql/ -sw '%{http_code}' -m 100) # если вернулся статус 201, значит закачалось удачно if [ $RESPONSE_STATUS == 201 ] then echo GOOD PUSH YANDEX echo GOOD BACKUP # удаляем бэкап из локальной папки unlink /var/www/mysql_backups/$MYSQL_FILE exit 0 # если не закачалось, отправляем смс и эл. письмо else echo BAD PUSH YANDEX curl -d "text=Error upload backup to Yandex Disk. Response Status Code != 201." http://sms.ru/sms/send\?api_id=111-444-8059-CE5E-5DSFDS8A8\&to=380631111111 echo "Response Status Code != 201." | mail -s "Error upload backup all-databases to Yandex Disk" example@example.ru exit 1 fi fi If I run in Ubuntu 14.04 through the terminal ./all_database.sh , the script works successfully, i.e. A backup is created and poured onto the Yandex disk:
And if I add a task to the crontab:
That script does not work out completely. That is, a dump is created and all. On Yandex disk file is not poured. And to look in some logs, for example, I can not, in and what caused the snag. I gave the file the right chmod 777 , but it still does not fully work, although if the problem would be in the rights, then the dump would not have been created.
Please tell me what could be the problem?


echo $RESPONSE_STATUSand see what it returns. - MANK