#!/bin/bash

function exit_func {
	echo "SIGTERM detected"
	exit 1
}
trap exit_func SIGTERM SIGINT

ASD_BINDIR="/home/asdynamics/private/${ASD_BUILDNAME}/bin"

$ASD_BINDIR/ensureConstraints.php

if [ $? -ne 0 ]; then
	echo "Impossible to ensure constraints";
	exit 1;
fi

mkdir -p "/tmp/asdynamics/${ASD_BUILDNAME}"

$ASD_BINDIR/processJobs.php & wait
exit $?
