CRS#008 - Automating ATG Server Startup & Creating .bat files



Writing the commands for starting the servers may be tedious sometimes, so we will automate this step, by creating windows .bat files.
To create a bat file, open notepad, write the commands as mentioned in each of the sections, and save the file with ".bat" extension. We recommend saving all the files in a single folder [e.g. D:\ATG\bats]

Firstly, create a folder "bats" inside your ATG folder [D:\ATG\bats]. Next, you can write the scripts present below in notepad and save all of them inside the "bats" folder you just created.

1. Weblogic Admin startup script

Weblogic admin server can be started using startWebLogic.cmd present in the WEBLOGIC_DIR\domains\[your_domain_name] folder. You just have to change your directory in the bat file (using "cd" command) and use the startWebLogic.cmd utility. Your bat file should look like:
title ## WL ADMIN SERVER ###
D:
cd D:\Oracle\Middleware\domains\atg11
startWebLogic.cmd

2. Endeca Startup Script

Endeca Service can be started by "run.bat" command in the ToolsAndFrameworks folder. This file is usually located at [YOUR_ENDECA_DIRECTORY]\ToolsAndFrameworks\11.0.0\server\bin. You have to use the "cd" command to change the directory to this server and use the run.bat command. Your bat file should look like:
title ## ENDECA SERVER ###
D:
cd D:\Endeca\ToolsAndFrameworks\11.0.0\server\bin
run.bat


3. Prod & Pub startup script

The server can be started by using the weblogic's utility startManagedWebLogic.cmd followed by the server name. This utility is present in your WEBLOGIC_DIR\domains\[your_domain_name]\bin. E.g. if the server name is atg_production_lockserver, the command will be:
startManagedWebLogic.cmd atg_production_lockserver
Usually, when you want to see your server startup, you might want to have a look at the logs in the server window, and to be able to visually distinguish info logs from error logs.
There is a freeware utility called ATGLogColorizer. Adding this to your server startup script will make the different types of logs (info, debug, error etc) in different colors. The "red" color of the errors usually helps a lot.

a. Download the ATGLogColorizer from HERE.
b. Unzip the archive and put the in ATGLogColorizer_v1_2.exe in C:/Windows/System32
c. To use the ATGLogColorizer, your startup command will look like
startManagedWebLogic.cmd atg_production_lockserver | ATGLogColorizer_v1_2.exe
Now that we know what our command would look like, we just have to change the directory to the folder where startManagedWebLogic.cmd utility is present [i.e. WEBLOGIC_DIR\domains\[your_domain_name]\bin]

My Startup script for Production Server looks like:
title ## PROD CRS SERVER ###
D:
cd D:\Oracle\Middleware\domains\atg11\bin
startManagedWebLogic.cmd atg_production_lockserver| ATGLogColorizer_v1_2.exe
My Startup script for Publishing(BCC) Server looks like:
title ## PUB CRS SERVER ###
D:
cd D:\Oracle\Middleware\domains\atg11\bin
startManagedWebLogic.cmd atg_publishing_lockserver| ATGLogColorizer_v1_2.exe

To keep the scripts handy, you can also add them to your taskbar. 
a. Right Click on the taskbar
b. Select Toolbars
c. Select New Toolbar
d. Browse to your ATG folder
e. Single click on your "bats" folder and click "Select Folder"
f. bats folder will not appear on the taskbar.
g. Click on the arrow beside this folder and click on any of the bat files to start the server.

It should look like below:




No comments:

Post a Comment

Subscribe

Get All The Latest Updates Delivered Straight Into Your Inbox For Free!

Flickr