#!/bin/bash # Check if the war file is provided if [ -z "$1" ]; then echo "Usage: $0 /path/to/DEVPortal.war" exit 1 fi # Variables WAR_FILE="$1" TIMESTAMP=$(date +%Y%m%d%H%M%S) DEST_DIR="/app/apim/deploy/DVPWeb" BACKUP_DIR="/app/apim/backup" # Create backup directory if not exists mkdir -p $BACKUP_DIR # Backup the existing directory if [ -d "$DEST_DIR" ]; then echo "Backing up existing directory..." mv $DEST_DIR "${BACKUP_DIR}/dvp_${TIMESTAMP}" fi # Create destination directory if not exists mkdir -p $DEST_DIR # Unzip the file to the dedicated location echo "Extracting WAR file to $DEST_DIR..." unzip $WAR_FILE -d $DEST_DIR echo "deploy successful"