Script Backup DB ODOO

mkdir -p backup/odoo

 

vi backup_odoo.sh

 

#!/bin/sh

####### SCRIPTS BACKUP ######
# create : AGINK.ID
#############################
tgl=`date "+%Y%m%d-%H%M%S"`
HOME_DIR=/home/agink
BACKUP_DIR=$HOME_DIR/backup/odoo
ODOO_DATABASE=db_odoo
ADMIN_PASSWORD=master_password
ODOO_PORT=8014
URL=http://localhost:$ODOO_PORT/web/database/backup

echo "create a backup"
echo ""
curl -X POST \
-F "master_pwd=${ADMIN_PASSWORD}" \
-F "name=${ODOO_DATABASE}" \
-F "backup_format=zip" \
-o ${BACKUP_DIR}/${ODOO_DATABASE}.$tgl.zip \
$URL
echo ""
chown agink:users $BACKUP_DIR/*

echo "delete old backups"
echo ""

find ${BACKUP_DIR} -type f -mtime +3 -name "${ODOO_DATABASE}.*.zip" -delete

echo ""
echo "#--- DB Backup Done...!!!"

 

chmod +x backup_odoo.sh