Friday, December 25, 2009

Auto Restart BO Servers with a Batch job and Schedule it

Video walkthrough (all the way at the bottom): How to automate Business Objects' Services/Servers in Central Configuration Manger so that they restart every night, every week or however you'd like to schedule them.

Topics Covered:
1) Creating a batch job to restart any/all Business Objects Services
2) Scheduling the batch job according to the need of your environment

Business Objects, as you all know (well, the BOE people at least) runs using several types of servers-which are called 'services' in Windows. But we will refer to them as 'servers' because that's how BO decided to call them and that's how we see them in CMC.

One of the most essential tasks of maintaining a promptly responsive, error free and fresh Business Objects environment is to restart Business Objects services on a regular basis. If you are an Admin or have access to the machine where your BO software is installed, you can see the activities of BO, including it's servers' activities from the Event Viewer. Every so often, there are warnings and errors that get generated by BO servers. Sometimes, the WebI Report Server may generate "...Communication failure" error or the CrystalRAS may generate some registry error, or the CMS may generate "Database Access Error..."; you get the idea.

Of course, you may Google the error messages and try to get to the bottom of the problem - which is the best approach, by the way, but if you just create a batch job to automatically restart all your BOE servers, you will see your environment performing significantly better and most errors will disappear.

I've seen on few sites the suggest the batch to restart the servers in this manner:


NET STOP “Web Intelligence Job Server”
NET START “Web Intelligence Job Server”

NET STOP “Program Job Server”
NET START “Program Job Server”

NET STOP “Report Application Server”
NET START “Report Application Server”

and so on - you get the idea. STOP and START a server right away. I, however have it set up slightly differently - STOP all and then START all. I don't know if mine is better or the aforementioned is better, but I like mine better because it just looks 'cool' and it has a symmetry to it. :)

For those of you who are like 'wtfff' at this point and or new BO admins setting up your 1st batch job, here's a brief intro to Command Prompt in Windows. Do this: Start > Run > CMD (and then hit enter). Type NET and hit Enter. These are the basic commands. We will use START and STOP commands for restarting BO servers because all BO servers are also found in the Services - Control Panel > Administrative Tools > Services or type "Services.msc" in the Run window (see above) and hit enter.

WARNING:  Make sure, you are NOT in your Production environment when you are trying / setting up this batch job. Because the moment you STOP a server - that's it, all users utilizing that server will get error message or a failure and if you happen to STOP CMS, then it'll be a chaos and you'll surely get some yelling from your boss. So, do you testing on your Development/Test environment and if you don't have any, schedule an outage and or take permission first.

Also, I came across many time where every server would STOP and START perfectly, except CMS-it doesn't start up, remains shut down. For that our systems analyst put a delay in between the STOP and START segment using the "sleep.exe" command, found in Windows Server 2003 Resource Kit Tools. And we also used the START command for CMS several times so that if the CMS doesn't start at the 1st attempt, it'll start up at one of the following attempts. If you do not have "sleep.exe" tool, then simply remove it from the code below and

NOTE: You must change the code below, because this code is meant for my environment only and every environment has as different number of servers that are up. For example, I have 4 Web Intelligence Report Servers, but you have only 2. So, edit/delete accordingly.


CodeBATCH Script to Automate Restarting of Business Objects Server  (click here to open the code below on a new page).

@echo off
rem
rem This script restart several services on this server (Business-Objects-Server)
rem
rem batch script created by: Administrator
rem batch script created on: 12242009

set log_file_fdr=C:\restart_service\logs
set log_file=bob_restart_svc.log
if not exist "%log_file_fdr%" md "%log_file_fdr%"

for /f "tokens=*" %%i in ('time/t') do set ttime=%%i
for /f "tokens=*" %%j in ('date/t') do set ddate=%%j

net stop "World Wide Web Publishing Service"
net stop "WinHTTP Web Proxy Auto-Discovery Service"
net stop "Crystal Reports Job Server (2)"
net stop "Crystal Reports Job Server"
net stop "Crystal Reports Page Server"
net stop "Crystal Reports Cache Server"
net stop "Program Job Server"
net stop "Report Application Server(4)"
net stop "Report Application Server(3)"
net stop "Report Application Server(2)"
net stop "Report Application Server"
net stop "Web Intelligence Job Server"
net stop "Web Intelligence Report Server(4)"
net stop "Web Intelligence Report Server(3)"
net stop "Web Intelligence Report Server(2)"
net stop "Web Intelligence Report Server"
net stop "Destination Job Server"
net stop "Event Server"
net stop "List of Values Job Server"
net stop "Output File Repository Server"
net stop "Input File Repository Server"
net stop "Connection Server"
net stop "Central Management Server"

sleep.exe 60

net start "Central Management Server"
net start "Connection Server"
net start "Input File Repository Server"
net start "Output File Repository Server"
net start "List of Values Job Server"
net start "Event Server"
net start "Destination Job Server"
net start "Web Intelligence Report Server"
net start "Web Intelligence Report Server(2)"
net start "Web Intelligence Report Server(3)"
net start "Web Intelligence Report Server(4)"
net start "Web Intelligence Job Server"
net start "Report Application Server"
net start "Report Application Server(2)"
net start "Report Application Server(3)"
net start "Report Application Server(4)"
net start "Program Job Server"
net start "Crystal Reports Cache Server"
net start "Crystal Reports Page Server"
net start "Crystal Reports Job Server"
net start "Crystal Reports Job Server (2)"
net start "WinHTTP Web Proxy Auto-Discovery Service"

net start "Central Management Server"

net stop "IISAdmin" /y
net start "IISAdmin"
net start "World Wide Web Publishing Service"
net start "FTP Publishing Service"
net start "HTTP SSL"
net start "Network News Transfer Protocol (NNTP)"
net start "Simple Mail Transfer Protocol (SMTP)"


sleep.exe 60

net start "Central Management Server"

sleep.exe 60

net start "Central Management Server"


echo %ddate% %ttime% Business-Objects-Server services have been restarted.>> "%log_file_fdr%\%log_file%"

:end
exit
------------------------------

1 comment:

  1. This is very much a 'brute force' way to stop and restart those servers. The proper way is to disable the servers first, allow them to complete the requests that they are currently processing, and then issue the NET STOP/START. Has anyone done anything that would handle that in a batch type mode?

    ReplyDelete