#!/usr/bin/env bash
set -e
set -u
export INPUT=/scratch/input
export OUTPUT=/scratch/output
export TMPDIR=/scratch/output/tmp
export CONFIG=/scratch/configfile
export MSDIR=/scratch/msdir
export DISPLAY=:99
test -d $OUTPUT/.casa || { test -d /root/.casa && cp -r /root/.casa $OUTPUT/.casa; } || echo " "
export HOME=$OUTPUT
cd $HOME
xvfb-run python /scratch/code/run.py 2>&1
EXIT_STAT=${PIPESTATUS[0]}
exit $EXIT_STAT
