#!/bin/bash DATA_DIR="/mnt/data" RTE_DIR="/etc/rte" ENV_FILE="job_environment.sh" source_rte () { local stage=$1 rte_idx=0 rte_var="RUNTIME_ENVIRONMENT_${rte_idx}" while [ -n "${!rte_var}" ]; do if [ -f "${RTE_DIR}/${!rte_var}" ]; then source "${RTE_DIR}/${!rte_var}" $stage fi rte_idx=$((rte_idx+1)) rte_var="RUNTIME_ENVIRONMENT_${rte_idx}" done } mkdir -p ${DATA_DIR} mount /dev/vdb1 ${DATA_DIR} cd ${DATA_DIR} if [ ! -f "$ENV_FILE" ]; then echo "FATAL: Wrapped environment file not found. Failed to run job." exit 1 fi source "$ENV_FILE" source_rte 0 source_rte 1 $JOB_EXECUTABLE source_rte 2 poweroff