testsAndMisc/linux_configuration/scripts/usage-report-catchup.sh
Krzysztof kuhy Rudnicki 8be1fac8f9
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (mypy, mypy) (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (pylint, pylint) (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (rest, ) (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (shellcheck, shellcheck) (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
Shell tests / shell-tests (push) Waiting to run
Shell tests / lib-tests (push) Waiting to run
Shell tests / arch-tests (push) Waiting to run
linux_configuration: track ~/.local/bin wrapper scripts in repo, symlink instead of generating
Moves 7 loose ~/.local/bin scripts into linux_configuration/scripts/ and
tracks the flutter/dart git-env wrapper; fix_flutter_git_env.sh and
unreal_mcp_repo.sh now symlink to the tracked files instead of writing
heredocs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014yhTkYV6ZeuAbQYvykFGFc

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-11 18:49:56 +02:00

35 lines
737 B
Bash
Executable File

#!/bin/bash
set -euo pipefail
REPO="/home/kuhy/src/testsAndMisc"
RUN_SCRIPT="$REPO/run.sh"
OUT_DIR="$HOME/.local/share/usage-reports"
ATOP_DIR="/var/log/atop"
mkdir -p "$OUT_DIR"
if [[ ! -x "$RUN_SCRIPT" ]]; then
echo "usage-report-catchup: missing executable $RUN_SCRIPT" >&2
exit 1
fi
shopt -s nullglob
TODAY="$(date +%Y%m%d)"
for atop_file in "$ATOP_DIR"/atop_*; do
date_part="${atop_file##*_}"
if [[ ! "$date_part" =~ ^[0-9]{8}$ ]]; then
continue
fi
out_file="$OUT_DIR/usage-report-${date_part}.md"
tmp_file="$out_file.tmp"
if [[ "$date_part" == "$TODAY" || ! -s "$out_file" ]]; then
if "$RUN_SCRIPT" --date "$date_part" >"$tmp_file"; then
mv -f "$tmp_file" "$out_file"
else
rm -f "$tmp_file"
fi
fi
done