Files
FitTrack_GarminSync/get_sync_status.sh

30 lines
792 B
Bash
Executable File

#!/bin/bash
# This script retrieves the current status of a specific sync job.
# --- Configuration ---
API_BASE_URL="http://localhost:8001" # Adjust if your API is running on a different host/port
# --- Argument Parsing ---
if [ -z "$1" ]; then
echo "Usage: $0 <JOB_ID>"
exit 1
fi
JOB_ID="$1"
# --- Retrieve Sync Status ---
echo "Retrieving sync status for Job ID: ${JOB_ID}"
SYNC_STATUS_RESPONSE=$(curl -s "${API_BASE_URL}/api/sync/status/${JOB_ID}")
if [ -z "${SYNC_STATUS_RESPONSE}" ]; then
echo "Error: No response received from the API. Is the backend service running?"
exit 1
fi
echo "${SYNC_STATUS_RESPONSE}"
# Optional: Add more robust parsing and display of status if needed
# For example, using `jq` to pretty-print the JSON:
# echo "${SYNC_STATUS_RESPONSE}" | jq .