Everything going good! when I ran the WebLogic server from the PuTTY. It is working until when it is connected and alive. Once I went for break/Lunch the Windows system went to sleep then WebLogic server stopped due to PuTTY session inactive. To avoid this we can use the Wrapper start scripts.
Idea behind the wrapper script/ psuedo code
- Using the startWebLogic.sh script in background using &
- use the nohup -- no hungup to run the process even the PuTTY inactive or closed
- The log file generated by starting WebLogic server redirected to a separate file.
- The Standard error file also merged with standard output log
- Display the tail command after doing the above
- Additionally you can add back up of old WebLogic file with a time stamp this can be applicable in Production environments.
Start WebLogic Admin Server with wrapper script
nohup /domain/path/startscript.sh &
Applying the above ideas into the wrapper scripts you can write a sample startAdmin.sh script in your WebLogic Domain.
pavanbsd@ubuntu:~/wlsdomains/rdomain$ cat startradm.sh clear nohup ~/wlsdomains/rdomain/startWebLogic.sh 2>&1 >> ~/wlsdomains/logs/radm.out & echo "tail -f ~/wlsdomains/logs/radm.out"
ii. Customized start managed server scriptThe above wrapper scripts there must inclusion of domain name recommended for non-production or multiple domains running on the same machines. There is a need to specify speparate standard output file path, if it is pre-production or Performance load testing environment you must also include GC logs path. Some of the WebLogic managed servers must include PRE_CLASSPATH that need to be processed before weblogic.jar in the CLASSPATH and some of the library jar files must be processed after the weblogic.jar, set them in a separate directories pre and post. Add them to CLASSPATH and it must be exported before startWebLogic.sh or startManagedWebLogic.sh called.
The following start wrapper script saved as "startms
# The managed server name as argument for this script # File : startms.sh
# Usage: ./startms.sh mymanaged01
#==================================================== INSTANCE=$1 export INSTANCE # not mandatory SOURCE=$(cd -P -- "$(dirname -- "$0")" && pwd -P) cp $INST_HOME/$INSTANCE/logs/$INSTANCE.out $INST_HOME/$INSTANCE/logs/$INSTANCE.out.bkp nohup $SOURCE/startManagedWebLogic.sh $INSTANCE >$INST_HOME/$INSTANCE/logs/$INSTANCE.out 2>&1 & echo tail -f $INST_HOME/$INSTANCE/logs/$INSTANCE.out
Here $INST_HOME is defined in the user profile script.
These customized start scripts for admin server and managed servers. In the script make a copy of the last server instance log to instance.out_bkp. Some times due to some panic situations servers might crashed, after monitoring you found that it happen so restarting server should not loss that lost logs. If you maintain the backup of logs file automatically before starting the instance, then you are saved with that backup log file for further analysis about that crash.
Here in the above script, Most of the UNIX environments your script could use "nohup" that means no hung up when the remote machine is accessed with ssh/Putty.
If you create this script in development/QA environment same script can be used for production because keeping it more portable with SDIR (source directory path).
Keep writing us your comments for betterment in this blog.