Created
January 5, 2024 04:05
-
-
Save juanboterotech/b5f55c16744ef892187273d776ce287d to your computer and use it in GitHub Desktop.
Backup your WordPress website
This file contains hidden or 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
#!/bin/bash | |
# get current date | |
now = `date +"%Y-%m-%d"` | |
# copying WordPress files inside public_html folder | |
cd ~/public_html | |
tar -zcf "~/wordpress_$_now.tar.gz" wordpress_folder | |
# Database backup with mysqldump | |
# replace the <dbuser> and <dbpassword> with your database user credentials defined for WordPress site, without < and > | |
mysqldump -u <dbuser> –p <dbpassword> -h localhost database_name > "db_$_now.sql" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment