Created
March 2, 2013 20:21
-
-
Save vodolaz095/5073102 to your computer and use it in GitHub Desktop.
Upload MySQL database to YandexDisk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DATE=`date +%Y-%m-%d--%H-%M-%S` | |
YaDiskLogin="myName@yandex.ru" | |
yaDiskPassword="myPass" | |
MySQLLogin="root" | |
MySQLPassword="SecReT" | |
MySQLDB="MyDB" | |
storage_path="/home/myLogin/backup/mysql/" | |
mysql_backup_name="mysql-$DATE" | |
echo 'Creating local copy...' | |
mysqldump -u "$MySQLLogin" -p"$MySQLPassword" --databases "$MySQLDB">"$storage_path""$mysql_backup_name".sql | |
zip --junk-paths "$storage_path""$mysql_backup_name".sql.zip "$storage_path""$mysql_backup_name".sql | |
rm -f "$storage_path""$mysql_backup_name".sql | |
echo 'Created local copy!' | |
echo 'Uploading to YaDisk started' | |
curl -T "$storage_path""$mysql_backup_name".sql.zip -k https://'"$YaDiskLogin":"$YaDiskPassword"@'webdav.yandex.ru/backup/ | |
echo 'Uploading to YaDisk done!' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this works great, can you also create to backup public_html to yadisk ?