{"id":15113839,"url":"https://github.com/magepsycho/magento2-db-code-backup-bash-script","last_synced_at":"2025-10-23T05:31:15.544Z","repository":{"id":53725813,"uuid":"112787836","full_name":"MagePsycho/magento2-db-code-backup-bash-script","owner":"MagePsycho","description":"Bash Script: Backup Magento2 Code + Database","archived":false,"fork":false,"pushed_at":"2022-10-08T19:12:48.000Z","size":303,"stargazers_count":42,"open_issues_count":3,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-30T17:28:45.450Z","etag":null,"topics":["backup-database","backup-files","backup-script","bash-script","centos","code","database","debian","linux","magento","magento2","media","shell-script","ssh","terminal","ubuntu"],"latest_commit_sha":null,"homepage":"https://blog.magepsycho.com/bash-script-easily-backup-magento2-code-files-database/","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}},"created_at":"2017-12-01T21:18:08.000Z","updated_at":"2024-07-17T22:13:12.000Z","dependencies_parsed_at":"2023-01-19T15:35:12.661Z","dependency_job_id":null,"html_url":"https://github.com/MagePsycho/magento2-db-code-backup-bash-script","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagePsycho%2Fmagento2-db-code-backup-bash-script","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagePsycho%2Fmagento2-db-code-backup-bash-script/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagePsycho%2Fmagento2-db-code-backup-bash-script/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagePsycho%2Fmagento2-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/magento2-db-code-backup-bash-script/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237784795,"owners_count":19365931,"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","bash-script","centos","code","database","debian","linux","magento","magento2","media","shell-script","ssh","terminal","ubuntu"],"created_at":"2024-09-26T01:23:30.725Z","updated_at":"2025-10-23T05:31:09.010Z","avatar_url":"https://github.com/MagePsycho.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bash Script: Backup Magento2 Code + Database\n\nThis utility script helps you to backup Magento2 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/magento2-db-code-backup-bash-script/master/src/mage2-db-code-backup.sh -o mage2-backup.sh\nchmod +x mage2-backup.sh\n```\n\nTo make it system wide command\n```\nsudo mv mage2-backup.sh /usr/local/bin/mage2-backup.sh\n```\n\n## USAGE\n### To display help\n```\n./mage2-backup.sh --help\n```\n\n### To backup database only\n```\n./mage2-backup.sh --backup-db --src-dir=/path/to/magento2/root --dest-dir=/path/to/destination\n```\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./mage2-backup.sh --backup-db --use-mysql-config --src-dir=/path/to/magento2/root --dest-dir=/path/to/destination\n```\n\n### To backup code only\n```\n./mage2-backup.sh --backup-code --skip-media --src-dir=/path/to/magento2/root --dest-dir=/path/to/destination\n```\n\n### To backup code + database\n```\n./mage2-backup.sh --backup-db --backup-code --skip-media --src-dir=/path/to/magento2/root --dest-dir=/path/to/destination\n```\n\n**Notes**  \nIf you want to use custom backup name, you can pass `--backup-name=...` option.   \nIf this option is not used, the `mage2-backup.$DATETIME` will be used as a default basename for code \u0026 db backups.  \n*You can utilize this option if you want to automate the backup and download process*\n\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/mage2-backup.sh --backup-db --backup-code --skip-media --src-dir=/path/to/magento2/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![Mage2Backup Help](https://github.com/MagePsycho/magento2-db-code-backup-bash-script/raw/master/docs/mage2-backup-script-help-0.2.0.png \"Mage2Backup Help\")\n1. Mage2Backup Help\n\n![Mage2Backup in Action](https://github.com/MagePsycho/magento2-db-code-backup-bash-script/raw/master/docs/mage2-backup-script-in-action-0.2.0.gif \"Mage2Backup in Action\")\n2. Mage2Backup in Action\n\n## TO-DOS\n - S3 support\n - Google Drive support\n - Option to exclude log tables\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagepsycho%2Fmagento2-db-code-backup-bash-script","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagepsycho%2Fmagento2-db-code-backup-bash-script","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagepsycho%2Fmagento2-db-code-backup-bash-script/lists"}