#!/usr/bin/env bash # Submit outside the caller's process group; suitable for non-interactive agents. set -euo pipefail project_root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) log_dir="$project_root/outputs/logs" mkdir -p "$log_dir" nohup setsid bash "$project_root/scripts/download_ecmwf_baseline.sh" "${1:-1981-01}" "${2:-2020-12}" "${3:-1}" \ >"$log_dir/ecmwf_baseline_download.log" 2>&1 & pid=$! printf '%s\n' "$pid" > "$log_dir/ecmwf_baseline_download.pid" printf 'Submitted detached PID %s; log: %s\n' "$pid" "$log_dir/ecmwf_baseline_download.log"