26 lines
1.3 KiB
Bash
Executable File
26 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Pumping under WSL. Reads the credentials from the .env at the root of the repository (never versioned),
|
|
# runs pump.py in a throwaway uv environment (4 packages), then the post-processing of LENZSPITZE.
|
|
# extraction/pump.sh update of the tracked stations, images included (the scheduler)
|
|
# extraction/pump.sh --from D --to E [SERIAL] any other call: the arguments go to pump.py as they are
|
|
# Output appended to out/pump.log; one pumping at a time (lock out/pump.lock).
|
|
set -u
|
|
export PATH="$HOME/.local/bin:$PATH" # uv, missing from the PATH when the Task Scheduler starts wsl.exe
|
|
here=$(cd "$(dirname "$0")" && pwd)
|
|
root=$(dirname "$here")
|
|
mkdir -p "$root/out"
|
|
|
|
exec 9>"$root/out/pump.lock"
|
|
flock -n 9 || { echo "A pumping is already running." >&2; exit 1; }
|
|
|
|
[ $# -eq 0 ] && set -- --images --delay 300
|
|
{
|
|
echo "=== $(date -u +%Y-%m-%dT%H:%MZ) pump.py $*"
|
|
(set -a +u && . "$root/.env" && set +a -u && # +u: an unquoted $ in .env does not stop the load
|
|
uv run --no-project --quiet --python 3.12 \
|
|
--with sqlalchemy --with psycopg2-binary --with pandas --with boto3 \
|
|
python "$here/pump.py" "$@")
|
|
[ -f "$root/data/LENZSPITZE/lentzpitze_patterns.json" ] && python3 "$here/lenzspitze_absolute.py"
|
|
echo "=== $(date -u +%Y-%m-%dT%H:%MZ) end"
|
|
} 2>&1 | tee -a "$root/out/pump.log"
|