From d7800eb5c53287e9b0638fb520cf0a3cdbad14b5 Mon Sep 17 00:00:00 2001 From: Gray Williams Date: Fri, 19 Jun 2026 18:13:42 +0100 Subject: [PATCH] Create linux_triggerrefetch.sh (#47835) Adds a simple .sh script that can trigger a refetch locally from a host if required. ## Summary by CodeRabbit * **Documentation** * Updated the Linux script used to trigger Fleet refetch operations. It now runs with stricter Bash safety, validates and trims the system identifier before sending the request, and reports clear success/failure status while returning the appropriate nonzero exit code on errors. --- .../linux/scripts/linux_triggerrefetch.sh | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 docs/solutions/linux/scripts/linux_triggerrefetch.sh diff --git a/docs/solutions/linux/scripts/linux_triggerrefetch.sh b/docs/solutions/linux/scripts/linux_triggerrefetch.sh new file mode 100644 index 0000000000..487cc625ad --- /dev/null +++ b/docs/solutions/linux/scripts/linux_triggerrefetch.sh @@ -0,0 +1,27 @@ +#!/bin/bash +set -euo pipefail + +fleet_url="https://fleet.yourdomain.com" +identifier_file="/opt/orbit/identifier" + +if [[ ! -r "$identifier_file" ]]; then + echo "Missing or unreadable orbit identifier: $identifier_file" >&2 + exit 1 +fi + +orbit_identifier="$(tr -d '[:space:]' < "$identifier_file")" +if [[ -z "$orbit_identifier" ]]; then + echo "Orbit identifier is empty." >&2 + exit 1 +fi + +echo "Triggering refetch..." + +if curl -sf --connect-timeout 5 --max-time 20 -X POST \ + "$fleet_url/api/v1/fleet/device/$orbit_identifier/refetch" > /dev/null; then + echo "Refetch triggered successfully!" +else + rc=$? + echo "Refetch failed!" >&2 + exit "$rc" +fi