#!/bin/bash
#-----------------------------------------------------------------------
# This file is part of the irace R package
# http://iridia.ulb.ac.be/irace/
#-----------------------------------------------------------------------
# This program launches one run of iterated Race and can be used as
# the tune-main invoked by paralle-irace. This example shows how to
# carry out the tuning in /tmp/ but move back the results to the
# execution directory.
BINDIR=$1
EXECDIR=$2
shift 2
# Working on /tmp could be faster
tmpdir=$(mktemp -d -t ${HOSTNAME}-XXXXXXXXXX)
# STDOUT goes to /tmp
exec 1> $tmpdir/irace-$$.stdout 
# STDERR goes to execution directory
exec 2> $EXECDIR/irace-$$.stderr
echo $tmpdir/irace-$$.stdout >&2
$BINDIR/irace --exec-dir=$tmpdir $*
RET=$?
# Use command to avoid aliases
command cp --force -R $tmpdir/./ $EXECDIR/
rm -rf $tmpdir
exit $RET
