|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Copyright (c) 2022 Oracle and/or its affiliates. |
| 4 | +# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. |
| 5 | + |
| 6 | +cd /u01/data/bankapp/ || return 1 |
| 7 | + |
| 8 | +APPDIR=$(pwd) |
| 9 | +export APPDIR |
| 10 | + |
| 11 | +UNAME1=$(uname -n) |
| 12 | +TUX_UID=$(id -u) |
| 13 | +TUX_GID=$(id -g) |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | +# Get the bankapp sources and build it |
| 18 | +cp -rp "${TUXDIR}"/samples/atmi/bankapp/* "${APPDIR}/" |
| 19 | +export LD_LIBRARY_PATH="${TUXDIR}/lib:$LD_LIBRARY_PATH" |
| 20 | +make -f bankapp.mk TUXDIR="${TUXDIR}" APPDIR="${APPDIR}" |
| 21 | + |
| 22 | + |
| 23 | +# modify and run the environment setup script |
| 24 | +cp -p bankvar bankvar.new |
| 25 | + |
| 26 | + |
| 27 | +# shellcheck disable=SC2016 |
| 28 | +cat << 'EOF' >> bankvar.new |
| 29 | +# |
| 30 | +# For GWWS |
| 31 | +# |
| 32 | +GWTLOGDEVICE="${APPDIR}/GWTLOG" |
| 33 | +export GWTLOGDEVICE |
| 34 | +# |
| 35 | +# Device for binary file that gives SALT all its information |
| 36 | +# |
| 37 | +SALTCONFIG="${APPDIR}/saltconfig" |
| 38 | +export SALTCONFIG |
| 39 | +# |
| 40 | +# For graceful shutdown |
| 41 | +# |
| 42 | +export SHUTDOWN_MARKER_FILE="${APPDIR}/shutdown.marker" |
| 43 | +EOF |
| 44 | + |
| 45 | + |
| 46 | +# shellcheck disable=SC1091 |
| 47 | +source ./bankvar.new |
| 48 | + |
| 49 | + |
| 50 | +# clean up from any previous run |
| 51 | +tmshutdown -y &>/dev/null |
| 52 | +rm -f TLOG GWTLOG tuxconfig saltconfig bankdl1 bankdl2 bankdl3 ULOG.* |
| 53 | +rm -f "${SHUTDOWN_MARKER_FILE}" |
| 54 | + |
| 55 | + |
| 56 | +# Modify the Tuxedo configuration file |
| 57 | +sed -e "s;<TUXDIR1>;${TUXDIR};g" \ |
| 58 | + -e "s;<APPDIR1>;${APPDIR};g" \ |
| 59 | + -e "s;<user id from id(1)>;${TUX_UID};g" \ |
| 60 | + -e "s;<group id from id(1)>;${TUX_GID};g" \ |
| 61 | + -e "s;<SITE1's uname>;\"${UNAME1}\";g" \ |
| 62 | + -e "s;^MAXACCESSERS\(\s\+\).*$;MAXACCESSERS\1100;g" \ |
| 63 | + -e "s;^MAXSERVERS\(\s\+\).*$;MAXSERVERS\1100;g" \ |
| 64 | + -e "s;^MAXSERVICES\(\s\+\).*$;MAXSERVICES\1500;g" \ |
| 65 | + -e "s;^\(\s*\)\(ULOGPFX=.*\);\1\2\n\1MAXWSCLIENTS=15;g" \ |
| 66 | + -e 's;\(bankdl3:bankdb:readwrite".*$\);\1\nGWWSGRP GRPNO=4\n OPENINFO="" TMSNAME="" LMID=SITE1;g' \ |
| 67 | + -e 's;\(BALC\s\+SRVGRP=BANKB3\s\+SRVID=29.*$\);\1\ |
| 68 | +TMMETADATA SRVGRP=GWWSGRP SRVID=1 CLOPT="-A -- -f bankapp.repos" \ |
| 69 | +GWWS SRVGRP=GWWSGRP SRVID=2 CLOPT="-A -- -iGWWSRestful";g' \ |
| 70 | + ubbshm > ubbshm.new |
| 71 | + |
| 72 | + |
| 73 | +# Create ENVFILE |
| 74 | +export MASKPATH=${APPDIR} |
| 75 | +./envfile |
| 76 | + |
| 77 | + |
| 78 | +# Modify bankapp.dep |
| 79 | +sed -e "s;<APPDIR1>;${APPDIR};g" bankapp.dep > bankapp.dep.new |
| 80 | + |
| 81 | + |
| 82 | +# Compile the configuration file |
| 83 | +tmloadcf -y ubbshm.new || return 1 |
| 84 | +wsloadcf -y bankapp.dep.new || return 1 |
| 85 | + |
| 86 | + |
| 87 | +# Create the bank DB and the logs |
| 88 | +./crbank || return 1 |
| 89 | +./crtlog || return 1 |
| 90 | + |
| 91 | + |
| 92 | +# Boot up the domain |
| 93 | +tmboot -y |
| 94 | + |
| 95 | + |
| 96 | +# Insert sample records into the bank DB |
| 97 | +./populate |
| 98 | + |
| 99 | + |
| 100 | +# beginning section of logs to stdout |
| 101 | +cat "${APPDIR}/ULOG*" |
| 102 | + |
| 103 | + |
| 104 | +# Sleep till shutdown initiated |
| 105 | +while true; do |
| 106 | + if [ -e "${SHUTDOWN_MARKER_FILE}" ] ; then |
| 107 | + exit 0 |
| 108 | + fi |
| 109 | + |
| 110 | + sleep 1 |
| 111 | +done |
| 112 | + |
0 commit comments