diff --git a/template/after.sh.erb b/template/after.sh.erb index e69de29..fbd586a 100755 --- a/template/after.sh.erb +++ b/template/after.sh.erb @@ -0,0 +1,12 @@ +#!/bin/bash + +# Wait for the Matlab server to start +echo "Waiting for Matlab server to open port ${port}..." +if wait_until_port_used "${host}:${port}" 600; then + echo "Discovered Matlab server listening on port ${port}!" +else + echo "Timed out waiting for Matlab server to open port ${port}!" + clean_up 1 +fi +sleep 2 + diff --git a/template/before.sh.erb b/template/before.sh.erb index a216be9..b7f54bf 100755 --- a/template/before.sh.erb +++ b/template/before.sh.erb @@ -1,3 +1,5 @@ +#!/bin/bash + [[ $(type -t module) == "function" ]] && export -f module port=$(find_port ${host}) diff --git a/template/script.sh.erb b/template/script.sh.erb index e1d5af3..0460924 100755 --- a/template/script.sh.erb +++ b/template/script.sh.erb @@ -1,3 +1,4 @@ +#!/bin/bash module purge module restore