#!/bin/sh

PATH=../../../daemon:../../../imr:$PATH
MICORC=/dev/null
export MICORC

# run Micod
rm -f micod.ref Bank.ref
micod --forward --ior micod.ref &
daemon_pid=$!
trap "kill $daemon_pid > /dev/null 2> /dev/null" 0
for i in 0 1 2 3 4 5 6 7 8 9 ; do if test -r micod.ref ; then break ; else sleep 1 ; fi ; done

# Add imr info
imr -ORBImplRepoIOR file://`pwd`/micod.ref create Bank poa `pwd`/server IDL:Bank:1.0
imr -ORBImplRepoIOR file://`pwd`/micod.ref activate Bank
for i in 0 1 2 3 4 5 6 7 8 9 ; do if test -r Bank.ref ; then break ; else sleep 1 ; fi ; done

# run client
./client
