This script will enable you to backup your WordPress websites automatically. Just put it in a crontab / automatic scheduling software somewhere.
Also available on Pastebin : https://pastebin.com/nZ2fiL8j
Enjoy.
#!/bin/bash # wordpress-auto-backup.sh ### THIS SCRIPT ASSUMES THE FOLLOWING # 1/ You can do SSH password-less login to the server # How : https://easyengine.io/tutorials/linux/passwordless-authentication-ssh/ # 2/ You have created a correct ~/.my.cnf file # How : https://easyengine.io/tutorials/mysql/mycnf-preference/ ### RUNTIME PARAMETERS # wordpress-auto-backup.sh <server address> <home directory> <backup directory> ### HOW IT WORKS # 1/ SSH to server # 2/ read wp-config file & get details # 3/ create backup_dir/web # 4/ rsync home_dir backup_dir/web # 5/ backup database to backup_dir/web/today.mysql # 6/ compress backup_dir/web to backup_dir/backup_today.bz2 ### choose backup retention # backup retention: weekly today=`date +%A` # backup retention: monthly #today=`date +%d` compressor1='gzip' compressor2='pbzip2' #============= START BACKUP ======================= # to help making this code more readable server=$1 home_dir=$2 backup_dir=$3 # get the variables ssh $server "cat $home_dir/wp-config.php" > /tmp/$server$today.txt db_name=`cat /tmp/$server$today.txt | grep DB_NAME | cut -d"'" -f 4` db_user=`cat /tmp/$server$today.txt | grep DB_USER | cut -d"'" -f 4` db_pass=`cat /tmp/$server$today.txt | grep DB_PASSWORD | cut -d"'" -f 4` db_host=`cat /tmp/$server$today.txt | grep DB_HOST | cut -d"'" -f 4` table_prefix='' table_prefix=`cat /tmp/$server$today.txt | grep table_prefix | cut -d"'" -f 2` # debug #echo $db_name $db_user $db_pass $db_host $table_prefix # delete temporary file rm /tmp/$server$today.txt # backup database ssh $server "mysqldump -h $db_host -u $db_user --password=\"$db_pass\" $db_name \$(mysql -h $db_host -u $db_user --password=\"$db_pass\" -D $db_name -Bse \"show tables like '$table_prefix%'\") > $home_dir/db-$today.mysql" # compress database dump ssh $server "$compressor1 $home_dir/db-$today.mysql" # download everything mkdir $backup_dir/web/ rsync -avuz $server:$home_dir/* $backup_dir/web/ # make backup file tar cvf $backup_dir/$server-$today.tar $backup_dir/web/ $compressor2 $backup_dir/$server-$today.tar & # clean up ssh $server "rm $home_dir/db-$today.mysql.gz" # done !
Lengkap dari buku panduan..keren gan
artikel yang sangat bagus dan menarik
Sangat bermanfaat, The Presidents Executive Karaoke Purwokerto
Terimakasih atas infonya gan
http://iroskesehatanherbal.blogspot.com/p/cara-pembelian-qnc-jelly-gamat.html
Thanks infonya gan ^^
Situs Poker Online
Thanks for article
Situs Poker Online
Nice boss
Terima Kasih info nya
Volcano Run
Volcano Run 2019
untuk implementasinya apakah akan sulit mas? saya kurang tahu dan paham cara penerapannya gimana supaya bisa backup via SSH ini..
Nice article!
saya akan coba untuk coding seperti ini.
Nice info gan… Thanks
Hello would you mind sharing which blog platform you’re working with? I’m looking to start my own blog in the near future but I’m having a hard time choosing between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design and style seems different then most blogs and I’m looking for something completely unique. P.S Apologies for getting off-topic but I had to ask!
Thank you for info all
artikel terakhir 2018 masih ada ga
mantap, bagus sekali artikelnya dan sangat membantu
PSBB
Cara Mengatasi Nyeri Tulang Leher Bagian Belakang
Khasiat Ricalinu
Kopi Perangsang Pria
Cara Mengatasi Nyeri Sendi Ibu Jari Tangan
Artikel yang bagus mas, teruskan
salam
FILTER AIR INDUSTRI
http://www.filterairindustri.com
Bagus nih Kalau lupa perpanjang server, minimal kontennya ga hilang
Paket Aqiqah Bandung
Mantap bro
Great article. It is very useful and informative. Thanks a lot for sharing this post. – chennai to shirdi flight packages
Sri Sairam Subhayatra
https://www.srisairamsubhayatra.org/shirdi-flight-packages-from-chennai.php
lengkap dan sangat membantu banyak blogger. terima kasih ngab
Thank you for info all
Segera daftar di situs judi online terbaik BK8. Di website BK8 anda diberikan layanan livestreaming bola tanpa delay jika sudah menjadi member.
BK8 juga memberikan kemudahan dalam bertransaksi, baik deposit dana maupun withdraw.
Great content. Are you also searching for Nursing capstone writing help? we are the best solution for you. We are best known for delivering the best nursing capstone writing services to students without having to break the bank.
Great blog this is.Are you also searching for Nursing care plan help? we are the best solution for you. We are best known for delivering nursing care plan to students without having to break the bank.whatsapp us:+1-(951)-468-9855
Artikel yang bagus mas, teruskan
salam
FILTER AIR YAMAHA
https://www.masterfilterair.com/
Thank you for info all
https://www.masterfilterair.co.id/2022/11/filter-air-pik-jakarta-utara.html
“Adeena’s Kitchen is a Restaurant and Takeaway in Croydon. We serve popular and authentic Indian Cuisine to customers from all over the world.Adeena’s Kitchen is a Restaurant and Takeaway in Croydon. We serve popular and authentic Indian Cuisine to customers from all over the world.
The chef has 30 years of experience especially in Chicken and Mutton Curry, Biryani Dishes and Seafood – all with special herbs and ingredients of Indian cuisine.
Hello sufehmi.com webmaster, Your posts are always well-balanced and objective.
Hello sufehmi.com admin, You always provide clear explanations and step-by-step instructions.
Hi sufehmi.com webmaster, Keep up the good work, admin!
Hello sufehmi.com owner, Your posts are always well-written and easy to understand.
Hi sufehmi.com owner, Well done!
To the sufehmi.com webmaster, You always provide in-depth analysis and understanding.
To the sufehmi.com admin, Your posts are always on point.
To the sufehmi.com webmaster, Your posts are always well received by the community.
To the sufehmi.com webmaster, You always provide great examples and real-world applications, thank you for your valuable contributions.
To the sufehmi.com webmaster, Thanks for the detailed post!
Hello sufehmi.com administrator, You always provide clear explanations and definitions.
Dear sufehmi.com admin, Thanks for the well-structured and well-presented post!
Dear sufehmi.com webmaster, Your posts are always well presented.
Dear sufehmi.com owner, Thanks for the well-researched and well-written post!
To the sufehmi.com webmaster, You always provide useful tips and best practices.
To the sufehmi.com admin, Your posts are always on point.
Hello sufehmi.com admin, Thanks for the well-researched and well-written post!
Hello sufehmi.com admin, Your posts are always well-referenced and credible.
Dear sufehmi.com webmaster, Thanks for the well-written and informative post!
To the sufehmi.com webmaster, Keep sharing your knowledge!
Dear sufehmi.com owner, Your posts are always well researched.
Dear sufehmi.com admin, Your posts are always well researched.
Hello sufehmi.com webmaster, Great content!
Hi sufehmi.com admin, Your posts are always well received by the community.
To the sufehmi.com administrator, Keep up the great work!
Dear sufehmi.com owner, Your posts are always well structured and easy to follow.
Dear sufehmi.com webmaster, You always provide helpful information.
Dear sufehmi.com admin, You always provide helpful information.