Last active
August 3, 2024 13:06
-
-
Save MalikAbuShabab/3e9efede7e6922d1c693298dd8a2eab0 to your computer and use it in GitHub Desktop.
Odoo Backup
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 | |
| # vars | |
| BACKUP_DIR=~/odoo_backups | |
| ODOO_DATABASE=db1 | |
| ADMIN_PASSWORD=superadmin_passwd | |
| # create a backup directory | |
| mkdir -p ${BACKUP_DIR} | |
| # create a backup | |
| curl -X POST \ | |
| -F "master_pwd=${ADMIN_PASSWORD}" \ | |
| -F "name=${ODOO_DATABASE}" \ | |
| -F "backup_format=zip" \ | |
| -o ${BACKUP_DIR}/${ODOO_DATABASE}.$(date +%F).zip \ | |
| http://localhost:8069/web/database/backup | |
| # delete old backups | |
| find ${BACKUP_DIR} -type f -mtime +7 -name "${ODOO_DATABASE}.*.zip" -delete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment