Created
September 30, 2024 01:38
-
-
Save kkarthee/dfc13d555039ffd961b49414c4d161ae to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Set WebLogic environment variables | |
| export DOMAIN_HOME=/weblogic/Oracle/Middleware/Oracle_Home/user_projects/domains/dlpuatapp_domain/ # Change this to your domain path | |
| export WL_HOME=/weblogic/Oracle/Middleware/Oracle_Home/oracle_common/common/ # Change this to your WebLogic installation path | |
| # Paths to logs | |
| ADMIN_SERVER_LOG=$DOMAIN_HOME/servers/AdminServer/logs/AdminServer.log | |
| NODEMANAGER_LOG=$DOMAIN_HOME/servers/logs/NodeManager.log | |
| MANAGED_SERVER1_LOG=$DOMAIN_HOME/logs/ManagedServer1.log | |
| MANAGED_SERVER2_LOG=$DOMAIN_HOME/logs/ManagedServer2.log | |
| # Function to check if a process is running | |
| check_process() { | |
| if pgrep -f "$1" > /dev/null; then | |
| echo "$1 is already running." | |
| return 1 | |
| else | |
| return 0 | |
| fi | |
| } | |
| # Start the Admin Server | |
| start_admin_server() { | |
| echo "Starting Admin Server..." | |
| check_process "weblogic.Admin" # Check if the Admin Server is running | |
| if [ $? -eq 0 ]; then | |
| nohup $DOMAIN_HOME/bin/startWebLogic.sh > $ADMIN_SERVER_LOG 2>&1 & | |
| echo "Admin Server started, check logs at $ADMIN_SERVER_LOG" | |
| sleep 60 # Give Admin Server time to start | |
| fi | |
| } | |
| # Start the Node Manager | |
| start_node_manager() { | |
| echo "Starting Node Manager..." | |
| check_process "NodeManager" # Check if Node Manager is running | |
| if [ $? -eq 0 ]; then | |
| nohup $WL_HOME/server/bin/startNodeManager.sh > $NODEMANAGER_LOG 2>&1 & | |
| echo "Node Manager started, check logs at $NODEMANAGER_LOG" | |
| sleep 10 # Give Node Manager time to start | |
| fi | |
| } | |
| # Start a Managed Server | |
| start_managed_server() { | |
| SERVER_NAME=$1 | |
| SERVER_LOG=$2 | |
| echo "Starting Managed Server: $SERVER_NAME..." | |
| check_process "$SERVER_NAME" # Check if the Managed Server is running | |
| if [ $? -eq 0 ]; then | |
| nohup $DOMAIN_HOME/bin/startManagedWebLogic.sh $SERVER_NAME t3://localhost:7001 > $SERVER_LOG 2>&1 & | |
| echo "$SERVER_NAME started, check logs at $SERVER_LOG" | |
| sleep 30 # Give Managed Server time to start | |
| fi | |
| } | |
| # Main script logic to start Admin Server, Node Manager, and Managed Servers | |
| echo "Starting WebLogic Servers..." | |
| start_admin_server | |
| start_node_manager | |
| # Start Managed Servers | |
| start_managed_server "ManagedServer1" $MANAGED_SERVER1_LOG | |
| start_managed_server "ManagedServer2" $MANAGED_SERVER2_LOG | |
| echo "All WebLogic Servers started. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment