Introduce incidenti con dedup, job Sidekiq ogni 3 min, scan log cron, /up/deep, dashboard /admin/ops e push ntfy; include Sentry opzionale e fix test suite. Co-authored-by: Cursor <cursoragent@cursor.com>
35 lines
1.1 KiB
Bash
Executable File
35 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Installa crontab replay su server produzione (utente corrente).
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
RUNNER="${ROOT}/scripts/cron/run_rails_task.sh"
|
|
SCAN_LOGS="${ROOT}/scripts/cron/scan_ops_logs.sh"
|
|
LOG_DIR="${MATCHLIVETV_LOG_DIR:-/opt/matchlivetv/log}"
|
|
LOG_FILE="${LOG_DIR}/cron-replay.log"
|
|
OPS_LOG_FILE="${LOG_DIR}/cron-ops.log"
|
|
|
|
chmod +x "$RUNNER" "$SCAN_LOGS"
|
|
mkdir -p "$LOG_DIR"
|
|
|
|
MARKER="# matchlivetv-replay-cron"
|
|
CRON_BLOCK="${MARKER}
|
|
30 * * * * ${RUNNER} recordings:cleanup_local >> ${LOG_FILE} 2>&1
|
|
0 3 * * * ${RUNNER} recordings:purge_expired >> ${LOG_FILE} 2>&1
|
|
0 8 * * * ${RUNNER} recordings:expiry_warnings >> ${LOG_FILE} 2>&1
|
|
*/10 * * * * ${SCAN_LOGS} >> ${OPS_LOG_FILE} 2>&1
|
|
"
|
|
|
|
existing="$(crontab -l 2>/dev/null || true)"
|
|
filtered="$(echo "$existing" | grep -v "$MARKER" | grep -v 'run_rails_task\.sh' || true)"
|
|
if echo "$existing" | grep -q "$MARKER"; then
|
|
echo "Crontab replay già presente, aggiorno..."
|
|
fi
|
|
{
|
|
[ -n "$filtered" ] && echo "$filtered"
|
|
echo "$CRON_BLOCK"
|
|
} | sed '/^$/d' | crontab -
|
|
|
|
echo "Crontab installato:"
|
|
crontab -l | grep -A3 "$MARKER"
|