2025-02-26 10:32:07 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2025-02-26 12:30:30 +01:00
|
|
|
error_ids=""
|
2025-02-26 10:32:07 +01:00
|
|
|
# Only run if this is the only instance of this script running
|
2025-02-26 11:50:34 +01:00
|
|
|
# note: since this script forks to run pgrep, we need -eq 2 here
|
2025-02-26 12:09:59 +01:00
|
|
|
if [[ $(pgrep -f "${0}" | wc -l) -eq 2 ]]; then
|
|
|
|
# We sleep a deterministic amount of time, which will be between 0 an 128 m and allways the same within
|
|
|
|
# a specific host, but will differ between hosts
|
|
|
|
sleep $((16#$(ip a | grep "link/ether" | head -1 | awk -F ':' '{print $6}' | awk '{print $1}') / 2))m
|
2025-02-26 10:32:07 +01:00
|
|
|
for container in $(get_containers); do
|
|
|
|
for id in $(nocc "${container}" files_external:list --all --output json | jq '.[].mount_id' | jq .); do
|
2025-02-26 12:30:30 +01:00
|
|
|
nocc "${container}" files_external:scan "${id}" | grep Error
|
|
|
|
# shellcheck disable=SC2181
|
|
|
|
if [[ ${?} -eq 0 ]]; then
|
2025-02-26 12:36:58 +01:00
|
|
|
error_ids="${error_ids} ${container}: ${id}"
|
2025-02-26 12:30:30 +01:00
|
|
|
fi
|
2025-02-26 10:32:07 +01:00
|
|
|
done
|
|
|
|
done
|
|
|
|
fi
|
2025-02-26 12:30:30 +01:00
|
|
|
|
|
|
|
if [[ -n "${error_ids}" ]]; then
|
|
|
|
echo "Errors found in the following mounts: ${error_ids}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
exit 0
|