One of the useful functions presented in the sample program is a way to read progress information and general message from the DB2 installer, and report process back to the user.

The sample program only installs a DB2 product using a response file. You can add your customized application deployment codes into it, or just use this sample program as one of the steps in your deployment script.

These are the steps to build and deploy using the sample program written in C language:

1.Create a working folder for the sample program:

#mkdir -p /tmp/db2rsp/smpinst

2.Locate the sample program under the subdirectory in the DB2 installation image. Copy required files to the working place and rename the makefile, which is platform specific.

#cd /software/V95/ese/db2/samples/c

#cp InstallTester.h Makefile.Linux InstallTester.c /tmp/db2rsp/smpinst

#cd /tmp/db2rsp/smpinst

#mv Makefile.Linux makefile

3.Use the makefile to build an executable program:

#make all

gcc -c -O2 -Wall -o InstallTester.o InstallTester.c gcc -o InstallTester InstallTester.o

4.The generated executable program is named InstallTester. It requires two command line options. The first parameter is for the full path of db2setup, and second parameter is for the response file. This binary file can be invoked using the following command:

./InstallTester <location of db2setup> -r <location of response file>

5.Set the INTERACTIVE keyword:

Make sure that the INTERACTIVE keyword in the response file is set to MACHINE. We use the response file illustrated in Example 2-7 on page 53 and change the keyword value as shown here in Example 2-8.The value MACHINE for the keyword INTERACTIVE tells DB2 installer to generate progress information and general message in a format that can easily be parsed by another program. In our case, it is parsed by InstallTester.

Example 2-8 The value of keyword INTERACTIVE is changed

INTERACTIVE

= MACHINE

 

 

6.Finally, the command to start the deployment is:

./InstallTester /software/V95/ese/db2setup -r /tmp/db2rsp/db2ese.rsp

56DB2 Deployment Guide

Page 70
Image 70
IBM manual Example 2-8 The value of keyword Interactive is changed, 56 DB2 Deployment Guide