IBM Data Server DB2 User Manual
Page 179
Chapter 4. Deploying applications with DB2
165
4. The purpose of the script app_install is to copy an application file and extract
CLI driver files to the specified path, and to perform application environment
configurations after the deployment. Example 4-12 shows the script code.
The script app_install has two command line options:
– The option -p specifies the path on the target machine indicating where
the application is to be deployed.
– The option -r indicates that we want the script to configure the system
variables for us. Do not use this option if you want the configuration to be
done manually.
Example 4-12 Source codes of script app_install
#!/usr/bin/ksh
##########################################################################
#
# Deploy application and ODBC CLI driver files to target path
#
# app_install -p
#
# -p specify the location where application and ODBC drv files to be deployed
# -r specify to configure system variable for ODBC and CLI driver
#
# example: app_install -p /home/db2app/myapp -r"
#
##########################################################################
# Define variables
DIR_DRV=odbcdrv # directory for odbc and cli driver files
DIR_APP=bin # directory for applications
unset REGVAR
# command-line syntax
syntax()
{
echo "
app_install -p
-p specify the location where application and ODBC lib files will be deployed
-r specify to configure system variable for ODBC and CLI driver
example: app_install -p /home/db2app/myapp -r"
}
# main program
# process command-line options
case $# in
0) syntax
exit 1;;
*)
while getopts "p:r" OPT;
do