#!/usr/bin/env bash # 与旧机 `su alchemy -c "/mnt/huiwing/huiwing/run_rotate.sh"` 等价:对各 crate 目录下 # logrotate.config 执行 logrotate(状态文件各目录独立 ./logrotate.status)。 # 本脚本位于 huike-back 根;默认 monorepo 为上一级(含 AuthCore、huike-back)。 # 可覆盖:export HUIWING_REPO=/path/to/huiwing-migration set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" REPO="${HUIWING_REPO:-$(cd "$SCRIPT_DIR/.." && pwd)}" AUTH="${HUIWING_AUTH:-$REPO/AuthCore}" rotate_one() { local dir="$1" [ -d "$dir" ] || return 0 [ -f "$dir/logrotate.config" ] || return 0 ( cd "$dir" && /usr/sbin/logrotate -s ./logrotate.status ./logrotate.config ) } rotate_one "$AUTH/htyuc" rotate_one "$REPO/huike-back/htyws" rotate_one "$REPO/huike-back/htykc" rotate_one "$REPO/huike-back/htyts" rotate_one "$REPO/huike-back/htyproc"