#!/bin/bash ## ## Build + boot the Enduro/X acquiring slice, then stay alive. ## Runs inside the app container (image acquire-x/endurox:7.0.12). ## set -e . /app/conf/setapp.sh echo "==================================================================" echo " acquire-core-x : build + boot" echo "==================================================================" # runtime dirs mkdir -p /app/log /app/tmp /app/tmlogs/rm1 /app/bin rm -f /app/log/*.log 2>/dev/null || true # ensure posix mqueue is available (compose provides the sysctls/ulimits) if [ ! -d /dev/mqueue ]; then mkdir -p /dev/mqueue mount -t mqueue none /dev/mqueue 2>/dev/null || true fi # --------------------------------------------------------------------------- # 1. UBF field header from the field table # --------------------------------------------------------------------------- echo "--- mkfldhdr acq.fd ---" cd /app/ubftab FIELDTBLS=acq.fd FLDTBLDIR=/app/ubftab mkfldhdr acq.fd ls -l /app/ubftab/acq.fd.h # --------------------------------------------------------------------------- # 2. ECPG precompile + buildserver each .pgc (XA switch loaded via env, so # buildserver needs no -r; we just link ecpg + pq). buildclient the driver. # --------------------------------------------------------------------------- export CFLAGS="-I/app/ubftab -I/app/src -I$(pg_config --includedir)" PGLIB="-L$(pg_config --libdir) -lecpg -lpq" cd /app/src build_svc () { local src="$1" bin="$2" echo "--- ecpg $src ---" ecpg -I/app/ubftab -o "/app/src/${src%.pgc}.c" "/app/src/$src" echo "--- buildserver -> $bin ---" buildserver -o "/app/bin/$bin" -f "/app/src/${src%.pgc}.c" -a "$PGLIB" } build_svc acquire.pgc acqacquire build_svc reconcile.pgc acqreconcile build_svc settle.pgc acqsettle echo "--- buildclient -> acqdrv ---" buildclient -o /app/bin/acqdrv -f /app/src/acqdrv.c ls -l /app/bin # --------------------------------------------------------------------------- # 3. Boot Enduro/X # --------------------------------------------------------------------------- echo "--- xadmin down/start ---" xadmin down -y 2>/dev/null || true xadmin start -y echo "--- xadmin psc (advertised services) ---" xadmin psc echo "--- xadmin ppm (processes) ---" xadmin ppm echo "==================================================================" echo " acquire-core-x : UP. Run the driver with:" echo " docker compose -f docker/docker-compose.yml exec app /app/run-driver.sh" echo "==================================================================" # keep the container (and the ndrxd daemon) alive tail -F /app/log/ndrxd.log