IBM Support

Starting WebSphere Liberty as a task

Question & Answer


Question

How can I set up WebSphere Liberty so it starts as a task for IBM i2 Analyze?

Answer

Creating the Batch File

  • Create a batch file which includes the following:

    set  TOOLKIT_SCRIPTS=C:\IBM\i2analyze\toolkit\scripts

    net start “SQL Server (MSSQLSERVER)”
    net start “IBM HTTP Server V8.5”

    %TOOLKIT_SCRIPTS%\setup -t startLiberty

    (The full script I used is attached at the end of this doc.)

Save the file to C:\IBM\i2analyze\startup\start_liberty.bat

Create Windows Task
  • Need to be logged in as Admin for this.
  • Open the task scheduler
  • Create a new task.
  • Under General tab...
    1. Enter name “Start_IBM_WebSphere_Liberty” or something
    2. Check “Run whether user is logged in or not”
    3. Check “Do not store password”
    4. Check “Run with highest privileges”
    5. Change user to iapuser
    • Under Triggers tab, create a new trigger.
      1. Begin the task at startup
    • Under Actions tab, create a new action.
      1. Select “Start a program”
      2. for program/script, browse to the BAT created above.
Running
  • Manually

    You should be able to simple execute the BAT file by double clicking it. Assuming the system did not just start up, it should execute fairly quickly (~30 sec) since it doesn't have to wait for the MSSQLSERVER or HTTP Server services to spin up.
  • Automatically at startup

    While the task is not disabled, the script should automatically fire at startup. It will wait for the MSSQL Server an HTTP Server to begin, then it will run the startup command for Liberty. Everything should be up and accessible within 10 minutes of the system restarting.

Logging

If the script at the end of this document is used, a log file will be created in the location specified in %LOG_LOC%. Currently, it is set to be placed in the same directory as the BAT file.

The logging is simple: a date and time is applied to the startup and the output of the Liberty startup script from IAP is redirected to this log file instead of to console.

start_liberty.bat

@echo off

REM This script is used to start the IBM WebSphere Liberty profile used to run REM IBM i2 Analyze 4.0.0 / 4.1.1.  It is intended to be used in conjunction
REM with a scheduled task to automate Liberty's startup whenREM the server is REM restarted.

REM set the path to the IAP toolkit scripts

set TOOLKIT_SCRIPTS=C:\IBM\i2analyze\toolkit\scripts

REM path to the log files.  Needs to be absolute path.

set LOG_LOC=C:\IBM\i2analyze\startup\liberty_startup.log

@echo ########%DATE% %TIME%########>> %LOG_LOC%

@echo Beginning Liberty startup script...>> %LOG_LOC%

@echo Checking that SQLSERVER is started...>> %LOG_LOC%

net start "SQL Server (MSSQLSERVER)">> %LOG_LOC%

@echo Checking that HTTP Server is started...>> %LOG_LOC%

net start "IBM HTTP Server V8.5">> %LOG_LOC%

%TOOLKIT_SCRIPTS%\setup -t startLiberty>> %LOG_LOC%

Related Information

[{"Product":{"code":"SSXVTH","label":"i2 Analyze"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"--","Platform":[{"code":"PF033","label":"Windows"}],"Version":"4.0.0;4.1.0","Edition":"All Editions","Line of Business":{"code":"LOB24","label":"Security Software"}}]

Document Information

Modified date:
16 June 2018

UID

swg21976542