feat: SAC 0.6.0 user edit UI, login to dashboard, daily report timer sync
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
# Генерирует sac-daily-report.timer из SAC_DAILY_REPORT_HOUR и SAC_DAILY_REPORT_TIMEZONE.
|
||||
# Usage: sudo deploy/systemd/render-sac-daily-report-timer.sh [config.env] [output.timer]
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
CONFIG_FILE="${1:-/opt/security-alert-center/config/sac-api.env}"
|
||||
OUTPUT="${2:-/etc/systemd/system/sac-daily-report.timer}"
|
||||
|
||||
HOUR=9
|
||||
TZ_NAME="Europe/Moscow"
|
||||
|
||||
if [ -f "${CONFIG_FILE}" ]; then
|
||||
set -a
|
||||
# shellcheck source=/dev/null
|
||||
source "${CONFIG_FILE}"
|
||||
set +a
|
||||
fi
|
||||
|
||||
HOUR="${SAC_DAILY_REPORT_HOUR:-9}"
|
||||
TZ_NAME="${SAC_DAILY_REPORT_TIMEZONE:-Europe/Moscow}"
|
||||
|
||||
if ! [[ "${HOUR}" =~ ^[0-9]+$ ]] || [ "${HOUR}" -lt 0 ] || [ "${HOUR}" -gt 23 ]; then
|
||||
printf 'render-sac-daily-report-timer: invalid SAC_DAILY_REPORT_HOUR=%s\n' "${HOUR}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
HOUR_PADDED="$(printf '%02d' "${HOUR}")"
|
||||
|
||||
cat >"${OUTPUT}" <<EOF
|
||||
[Unit]
|
||||
Description=Daily SAC report aggregation and notify
|
||||
|
||||
[Timer]
|
||||
OnCalendar=*-*-* ${HOUR_PADDED}:00:00
|
||||
Timezone=${TZ_NAME}
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
EOF
|
||||
|
||||
printf 'render-sac-daily-report-timer: wrote %s (OnCalendar=%s:00:00 Timezone=%s)\n' \
|
||||
"${OUTPUT}" "${HOUR_PADDED}" "${TZ_NAME}"
|
||||
@@ -2,8 +2,10 @@
|
||||
Description=Daily SAC report aggregation and notify
|
||||
|
||||
[Timer]
|
||||
OnCalendar=*-*-* 09:15:00
|
||||
RandomizedDelaySec=300
|
||||
# Шаблон по умолчанию (hour=9, Europe/Moscow). На prod timer перегенерируется
|
||||
# из config/sac-api.env: deploy/systemd/render-sac-daily-report-timer.sh или sac-deploy.sh
|
||||
OnCalendar=*-*-* 09:00:00
|
||||
Timezone=Europe/Moscow
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
|
||||
Reference in New Issue
Block a user