. $OSPL_HOME/examples/functions

check_osplhome

startOSPL

echo "=== Launching Ownership "
./sacpp_ownership_sub > subResult.txt &
sub_pid=$!
sleep 5

echo === starting publisher "pub1" with ownership strength 5
./sacpp_ownership_pub pub1 5 40 1 > pubResult_1.txt &	
pub1_pid=$!

echo === Waiting 2 seconds ...
sleep 2

echo === starting publisher "pub2" with ownership strength 10
./sacpp_ownership_pub pub2 10 5 0 > pubResult_2.txt &
pub2_pid=$!

echo === Waiting for processes to terminate
waitForProcessTermination $sub_pid 30
waitForProcessTermination $pub1_pid 30
waitForProcessTermination $pub2_pid 30

ownershipCheckResult

stopOSPL
