{"id":20095754,"url":"https://github.com/magepsycho/wordpress-db-code-backup-bash-script","last_synced_at":"2025-08-12T02:12:07.018Z","repository":{"id":142444308,"uuid":"186287117","full_name":"MagePsycho/wordpress-db-code-backup-bash-script","owner":"MagePsycho","description":"Bash Script: Backup Wordpress Code + Database ","archived":false,"fork":false,"pushed_at":"2022-06-06T14:07:34.000Z","size":173,"stargazers_count":7,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T08:51:12.493Z","etag":null,"topics":["backup-database","backup-files","backup-script","backup-tool","backup-utility","bash","bash-script","code","wordpress"],"latest_commit_sha":null,"homepage":"https://blog.magepsycho.com","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MagePsycho.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-12T17:58:57.000Z","updated_at":"2024-07-13T00:45:18.000Z","dependencies_parsed_at":"2023-04-07T05:46:24.766Z","dependency_job_id":null,"html_url":"https://github.com/MagePsycho/wordpress-db-code-backup-bash-script","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagePsycho%2Fwordpress-db-code-backup-bash-script","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagePsycho%2Fwordpress-db-code-backup-bash-script/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagePsycho%2Fwordpress-db-code-backup-bash-script/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagePsycho%2Fwordpress-db-code-backup-bash-script/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MagePsycho","download_url":"https://codeload.github.com/MagePsycho/wordpress-db-code-backup-bash-script/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252628893,"owners_count":21779100,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backup-database","backup-files","backup-script","backup-tool","backup-utility","bash","bash-script","code","wordpress"],"created_at":"2024-11-13T16:56:20.436Z","updated_at":"2025-05-06T05:31:18.633Z","avatar_url":"https://github.com/MagePsycho.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bash Script: Backup Wordpress Code + Database\n\nThis utility script helps you to backup Wordpress code and database.   \nYou can either run the command manually or can automate it via cronjob.\n\n\n## INSTALL\nYou can simply download the script file and give the executable permission.\n```\ncurl -0 https://raw.githubusercontent.com/MagePsycho/wordpress-db-code-backup-bash-script/master/src/wp-db-code-backup.sh -o wp-backup.sh\nchmod +x wp-backup.sh\n```\n\nTo make it system wide command\n```\nsudo mv wp-backup.sh /usr/local/bin/wp-backup\n```\n\n## USAGE\n### To display help\n```\n./wp-backup.sh --help\n```\n\n### To backup database only\n```\n./wp-backup.sh --backup-db --src-dir=/path/to/wp/root --dest-dir=/path/to/destination\n```\nIf you want to get rid of this message\n\u003e Using a password on the command line interface can be insecure.\n\nYou can create a `.my.cnf` file in home directory with the following config\n```\n[client]\nhost=localhost\nuser=[your-db-user]\npassword=[your-db-pass]\n```\nAnd use option `--use-mysql-config` as\n```\n./wp-backup.sh --backup-db --use-mysql-config --src-dir=/path/to/wp/root --dest-dir=/path/to/destination\n```\n\n### To backup code only\n```\n./wp-backup.sh --backup-code --skip-uploads --src-dir=/path/to/wp/root --dest-dir=/path/to/destination\n```\n- You can omit `--skip-uploads` option if you want to include `wp-content/uploads` folder in backup archive\n\n### To backup code + database\n```\n./wp-backup.sh --backup-db --backup-code --skip-uploads --src-dir=/path/to/wp/root --dest-dir=/path/to/destination\n```\n\n*You can omit `--src-dir` option if you are running the script as system-wide command from root folder of wordpress*\n\n### To schedule backup via Cron\nIf you want to schedule via Cron, just add the following line in your Crontab entry `crontab -e`\n```\n0 0 * * * /path/to/wp-backup.sh --backup-db --backup-code --use-mysql-config --skip-uploads --src-dir=/path/to/wp/root --dest-dir=/path/to/destination \u003e /dev/null 2\u003e\u00261\n```\n`0 0 * * *` expression means the command will run run at every midnight.\n\n## Screenshots\n![Wordpress Backup in Action](https://raw.githubusercontent.com/MagePsycho/wordpress-db-code-backup-bash-script/master/docs/wordpress-backup-script-in-action.gif \"Mage2Backup Help\")\nWordpress backup script\n\n## TO-DOS\n- Rotation for backups\n- Enable remote backups\n    - S3\n    - Google Drive\n    - Dropbox\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagepsycho%2Fwordpress-db-code-backup-bash-script","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagepsycho%2Fwordpress-db-code-backup-bash-script","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagepsycho%2Fwordpress-db-code-backup-bash-script/lists"}