Sample Operational Scheduler Script on WLSDM
-
Batch server process needs daily start and stop threadpoolworker operations. We have prepared how to stop and start threadpoolworker process. You can schedule these scripts/actions in WLSDM…
How to schedule threadpoolworker process?
WLSDM DevOps MBean Script:
Start TPW process is using
starttpw.sh -l job
command. The script is counting TPW process, if TPW process already exist, the script exits without executestarttpw.sh -l job
command.
PIDCount=$(ps -ef | grep -Ei "com.splwg.base.api.batch.ThreadPoolWorker" | grep -v grep | awk '{ print $2}'| wc -l) if [[ $PIDCount -gt 0 ]]; then (>&2 echo "!!! [WARNING] TPW process already exists. Script will be exit !!!") exit 1 fiecho "############### TPW WILL START ################" date # Start TPW Process echo "Starting TPW Process..." echo " nohup /appdata/ouaf/CCBPROD/bin/splenviron.sh -e CCBPROD -c 'starttpw.sh -l job' 1>/dev/null 2>/dev/null" nohup /appdata/ouaf/CCBPROD/bin/splenviron.sh -e CCBPROD -c "starttpw.sh -l job" 1>/dev/null 2>/dev/null echo "TPW Started Successfuly"
stopTPW.sh
script stops threadpoolworker by“spl.sh -b stop”
command.stopTPW.sh
is also checking TPW processes, if the process still exists, process executes “kill -9 $PID” command.echo "############### TPW WILL STOP ################" date # Stop TPW Process echo "Stopping TPW Process..." /appdata/ouaf/CCBPROD/bin/splenviron.sh -e CCBPROD -c "/appdata/ouaf/CCBPROD/bin/spl.sh -b stop" sleep 5 date echo "TPW Process stopped successfuly" # Check TPW processes then kill if exist PID=$(ps -ef | grep -Ei "com.splwg.base.api.batch.ThreadPoolWorker" | grep -v grep | awk '{ print $2}') PIDCount=$(ps -ef | grep -Ei "com.splwg.base.api.batch.ThreadPoolWorker" | grep -v grep | awk '{ print $2}'| wc -l) if [[ $PIDCount -gt 0 ]]; then echo "TPW not stopped correctly. Process will be killed" kill -9 $PID echo "TPW Processes are KILLED !!!" fi
WLSDM Threadpoolworker Scheduler Output:
How to move WebLogic/threadpool rotated logs?
If Threadpoolworker logs or server logs getting too large, there is another schedule script
“WLSDM-LinuxMoveLogs.sh”
. The script finds rotated log files then moves log files to the backup folder. Set “logPath” and “backupPath” then use WLSDM scheduler for daily backup.WLSDM DevOps MBean Script:
logPath=/data/weblogic/wlslogs/$1 backupPath=/data/weblogic/wlslogs/backups TIMESTAMP=`date +%Y-%m-%d` `mkdir $backupPath/$TIMESTAMP`find $logPath -type f -mtime -1 | grep -E 'log0|out0|diagnostic\-' | awk '$1' | xargs -I {} mv {} $backupPath/$TIMESTAMP