Wikipedia

Search results

Saturday 24 August 2024

Shell Script for WebSphere Patching

#!/bin/bash # Configuration WAS_HOME="/opt/IBM/WebSphere/AppServer" # WebSphere home directory PROFILE_NAME="AppSrv01" # WebSphere profile name IMCL_PATH="/opt/IBM/InstallationManager/eclipse/tools/imcl" # Installation Manager CLI path REPOSITORY_PATH="/path/to/repository" # Path to the repository containing the patches LOG_DIR="$WAS_HOME/logs/patching" # Directory to store patch logs PATCHES="com.ibm.websphere.ND.v85_8.5.5.15" # Patch ID(s) # Create log directory if it doesn't exist mkdir -p "$LOG_DIR" # Stop the server echo "Stopping WebSphere server..." "$WAS_HOME/profiles/$PROFILE_NAME/bin/stopServer.sh" server1 if [ $? -ne 0 ]; then echo "Failed to stop WebSphere server. Exiting." exit 1 fi # Apply the patch echo "Applying WebSphere patch..." "$IMCL_PATH" install "$PATCHES" -repositories "$REPOSITORY_PATH" -installationDirectory "$WAS_HOME" -log "$LOG_DIR/patching_$(date +'%Y%m%d%H%M%S').log" -acceptLicense if [ $? -ne 0 ]; then echo "Failed to apply WebSphere patch. Exiting." exit 1 fi # Start the server echo "Starting WebSphere server..." "$WAS_HOME/profiles/$PROFILE_NAME/bin/startServer.sh" server1 if [ $? -ne 0 ]; then echo "Failed to start WebSphere server. Exiting." exit 1 fi echo "WebSphere patching completed successfully."