#/bin/ksh

#/* Part of the Maestro sequencer software package.
# * Copyright (C) 2011-2015  Operations division of the Canadian Meteorological Centre
# *                          Environment Canada
# *
# * Maestro is free software; you can redistribute it and/or
# * modify it under the terms of the GNU Lesser General Public
# * License as published by the Free Software Foundation,
# * version 2.1 of the License.
# *
# * Maestro is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# * Lesser General Public License for more details.
# *
# * You should have received a copy of the GNU Lesser General Public
# * License along with this library; if not, write to the
# * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# * Boston, MA 02111-1307, USA.
# */

    # use /fasttmp if available
    tmpfs=`mktmpfs -L -s 1024 -c pid self 2>/dev/null` || true
    if [ -d "$tmpfs" ]; then
        echo '\n\n'Reset TMPDIR=$tmpfs'\n\n'
        export STD_TMPDIR=$TMPDIR
        export TMPDIR=$tmpfs
    else
        echo TMPDIR=$TMPDIR
    fi

    mkdir -p $TMPDIR/$SEQ_NAME/work
    cd $TMPDIR/$SEQ_NAME/work
    if [[ -d $TASK_BIN ]]; then 
        ln -s $TASK_BIN ../bin 
    fi
    if [[ -d $TASK_OUTPUT ]]; then 
        ln -s $TASK_OUTPUT ../output
    fi
    if [[ -d $TASK_INPUT ]]; then 
        ln -s $TASK_INPUT ../input
    fi
    export TASK_WORK=$(pwd)
