exec @docker @restore_db @no_cleanup
Some checks failed
Setup Native Action / native (3.12.7) (push) Has been skipped
Setup Native Action / docker (3.12.7) (push) Failing after 1m47s

This commit is contained in:
hoangvv 2025-01-15 15:51:01 +07:00
parent f4d9afe2e4
commit c8b202fbca

View File

@ -47,14 +47,18 @@ ColorReset() {
}
main(){
main() {
DEPLOYMENT_DIR=$(pwd)/deployment
BACKUP_DIR="$DEPLOYMENT_DIR/backup"
BACKUP_FILE="$BACKUP_DIR/backup.zip"
DOWNLOAD_URL="$1"
CONTAINER_ID="$2"
BACKUP_FILE="$DEPLOYMENT_DIR/backup/backup.zip"
# Create the deployment directory if it doesn't exist
mkdir -p "$DEPLOYMENT_DIR/backup"
# Check if the deployment and backup directories exist, create them if not
if [[ ! -d "$BACKUP_DIR" ]]; then
echo "Backup directory does not exist. Creating: $BACKUP_DIR"
mkdir -p "$BACKUP_DIR"
fi
# Check if the download URL is valid
echo "Checking if the URL is valid: $DOWNLOAD_URL"
@ -65,8 +69,8 @@ main(){
exit 1
fi
# Download the file
wget -P "$DEPLOYMENT_DIR/backup" -O backup.zip "$DOWNLOAD_URL"
# Download the file and rename it to backup.zip
wget -O "$BACKUP_FILE" "$DOWNLOAD_URL"
# Check if the file was downloaded
if [[ -f "$BACKUP_FILE" ]]; then
@ -81,4 +85,4 @@ main(){
sudo docker exec "${CONTAINER_ID}" odoo db --config=/etc/odoo/odoo.conf load backup /etc/odoo/backup/backup.zip
}
main $1 $2
main "$@"