Skip to content

Instantly share code, notes, and snippets.

@MalikAbuShabab
Last active August 3, 2024 13:06
Show Gist options
  • Select an option

  • Save MalikAbuShabab/3e9efede7e6922d1c693298dd8a2eab0 to your computer and use it in GitHub Desktop.

Select an option

Save MalikAbuShabab/3e9efede7e6922d1c693298dd8a2eab0 to your computer and use it in GitHub Desktop.
Odoo Backup
#!/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