Add --filter to arr_corruption_scan.sh for targeted testing
Full-library scans are slow to reach any one show by chance — this lets a test target a specific known-corrupt file/show without waiting on scan order.
This commit is contained in:
@@ -79,6 +79,9 @@
|
|||||||
# useful for a bounded first test)
|
# useful for a bounded first test)
|
||||||
# arr_corruption_scan.sh --log — verbose (prints every clean file too)
|
# arr_corruption_scan.sh --log — verbose (prints every clean file too)
|
||||||
# arr_corruption_scan.sh --status — show config and exit
|
# arr_corruption_scan.sh --status — show config and exit
|
||||||
|
# arr_corruption_scan.sh --filter=Becker — only consider paths containing this substring
|
||||||
|
# (testing/targeting a specific show; state
|
||||||
|
# file and everything else behaves normally)
|
||||||
#
|
#
|
||||||
# ==============================================================================================
|
# ==============================================================================================
|
||||||
|
|
||||||
@@ -90,10 +93,12 @@ source "$SCRIPT_DIR/../load_config.sh"
|
|||||||
# before they get filtered.
|
# before they get filtered.
|
||||||
REMEDIATE=false
|
REMEDIATE=false
|
||||||
SCAN_LIMIT=0
|
SCAN_LIMIT=0
|
||||||
|
PATH_FILTER=""
|
||||||
for _arg in "$@"; do
|
for _arg in "$@"; do
|
||||||
case "$_arg" in
|
case "$_arg" in
|
||||||
--remediate) REMEDIATE=true ;;
|
--remediate) REMEDIATE=true ;;
|
||||||
--limit=*) SCAN_LIMIT="${_arg#*=}" ;;
|
--limit=*) SCAN_LIMIT="${_arg#*=}" ;;
|
||||||
|
--filter=*) PATH_FILTER="${_arg#*=}" ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
unset _arg
|
unset _arg
|
||||||
@@ -171,6 +176,7 @@ if [[ "$SHOW_STATUS" == true ]]; then
|
|||||||
echo "$ICON_GEAR State file: $CORRUPTION_SCAN_STATE_FILE"
|
echo "$ICON_GEAR State file: $CORRUPTION_SCAN_STATE_FILE"
|
||||||
echo "$ICON_GEAR Remediate: $REMEDIATE"
|
echo "$ICON_GEAR Remediate: $REMEDIATE"
|
||||||
echo "$ICON_GEAR Scan limit: ${SCAN_LIMIT:-unlimited}"
|
echo "$ICON_GEAR Scan limit: ${SCAN_LIMIT:-unlimited}"
|
||||||
|
echo "$ICON_GEAR Path filter: ${PATH_FILTER:-none}"
|
||||||
echo "━━━━━━━━━━━━━━━━━━━━━━━"
|
echo "━━━━━━━━━━━━━━━━━━━━━━━"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
@@ -287,6 +293,7 @@ while IFS= read -r item; do
|
|||||||
|
|
||||||
host_path=$(translate_path "$api_path")
|
host_path=$(translate_path "$api_path")
|
||||||
[[ -f "$host_path" ]] || continue
|
[[ -f "$host_path" ]] || continue
|
||||||
|
[[ -n "$PATH_FILTER" && "$host_path" != *"$PATH_FILTER"* ]] && continue
|
||||||
|
|
||||||
stamp="$(stat -c '%Y:%s' "$host_path" 2>/dev/null)"
|
stamp="$(stat -c '%Y:%s' "$host_path" 2>/dev/null)"
|
||||||
[[ -z "$stamp" ]] && continue
|
[[ -z "$stamp" ]] && continue
|
||||||
|
|||||||
Reference in New Issue
Block a user