Monday, August 4, 2008

Delaying Service Startup

Issue:
Blackberry Enterprise Services fail to start because dependent database application is not up and running yet. Setting dependencies on services does not help.

Quick:
Found solution at Blackberry Support Site
Run gpedit.msc and set group policy start up script that waits before starting services

Visual:


Learning:
This solution is a good trick that could come in handy for simular issues with other services. Setting dependency here does not help because the dependent SQL service has started but has not yet brought the database online.

------------Start Text from Blackberry support site ------------

Run a script when Windows starts. This will start the BlackBerry Professional Software services after a short delay.
This script pauses for 2 minutes and starts the BlackBerry Dispatcher, BlackBerry Synchronization Service and BlackBerry Policy Service if it has been set to start automatically but has not started. It will not have a 2 minute delay when BlackBerry Dispatcher is running or set not to start automatically.

-----Start of Script copy below this line

Set ServerName = WScript.CreateObject("WScript.Network")
Set Computer = GetObject("WinNT://" & ServerName.ComputerName & ",computer")
Set Service = Computer.GetObject("service", "BlackBerry Dispatcher")
If Service.StartType = 2 and Service.Status <> 4 Then
WScript.Sleep(2*60*1000)
Service.Start

End If

Set Service = Computer.GetObject("service", "BlackBerry Policy Service")

If Service.StartType = 2 and Service.Status <> 4 Then
Service.Start
End If

Set Service = Computer.GetObject("service", "BlackBerry SyncServer")

If Service.StartType = 2 and Service.Status <> 4 Then
Service.Start
End If

-----End of Script copy above this line

Follow the steps below to have the above script running when Windows starts:
-Copy the above code and save it as a file called startservice.vbs (The file name can be anything but it should end with .vbs).
-Copy the script file (startservice.vbs) to the same location as the BlackBerry Professional Software installation (e.g. C:\Program Files\Research In Motion\BlackBerry Enterprise Server). -Select Start > Run > gpedit.msc to open the Group Policy Editor.
-Select Computer Configuration > Windows Settings > Scripts.
-Right-click on Startup, select Properties, and then select Add > Browse.
-Point to the file from the location in Step 2 and apply the changes.

------------End Text from Blackberry Support site---------------------

No comments: