diff --git a/ops/automations/registry.yaml b/ops/automations/registry.yaml index 42941c8..522c090 100644 --- a/ops/automations/registry.yaml +++ b/ops/automations/registry.yaml @@ -1,390 +1,557 @@ generated: '2026-10-28' -total: 112 +generator: ops/scripts/build-automations-registry.py +total: 124 +by_source: + crontab: 15 + cron.d: 56 + systemd: 42 + hermes: 11 automations: -- schedule: '* * * * *' - command: /opt/buryan-hub/scripts/swarm-watchdog.sh >> /var/log/swarm-watchdog.log +- schedule: 45 3 * * * + user: root + command: /usr/local/bin/backup-configs >> /var/log/backup-configs.log 2>&1 + source: cron.d/backup-configs +- schedule: 0 4 * * 0 + user: root + command: /opt/buryan-hub/scripts/cleanup-leftovers.sh >> /var/log/buryan-hub/cleanup-leftovers.log 2>&1 - source: crontab + source: cron.d/buryan-cleanup +- schedule: 0 6 * * * + user: root + command: for id in $(pct list | tail -n +2 | awk '{print $1}'); do pct exec $id + -- bash -s < /opt/buryan-hub/scripts/fix-logs.sh >/dev/null 2>&1; done + source: cron.d/buryan-log-hygiene - schedule: '*/5 * * * *' - command: python3 /opt/buryan-hub/scripts/direct-health-check.py >> /var/log/direct-health-check.log - 2>&1 - source: crontab -- schedule: 0 2 * * * - command: /opt/buryan-hub/scripts/pg-backup-ct151.sh >> /var/log/buryan-hub/backups/cron-pg.log - 2>&1 - source: crontab -- schedule: 0 3 * * * - command: /root/matrix-backups/backup-matrix.sh >> /var/log/buryan-hub/backups/cron-matrix.log - 2>&1 - source: crontab -- schedule: 30 3 * * * - command: /root/buryan-infra/ops/backup.sh >> /root/buryan-infra/ops/backups/backup.log - 2>&1 - source: crontab + user: root + command: . /root/.buryan-monitor.env && /usr/bin/python3 /opt/buryan-hub/scripts/check_thin_pool.py + >> /var/log/thin-pool-monitor.log 2>&1 + source: cron.d/buryan-monitor - schedule: 0 4 * * * - command: /opt/buryan-hub/scripts/offsite-backup.sh >> /var/log/buryan-hub/backups/cron-offsite.log + user: root + command: . /root/.buryan-monitor.env && /usr/bin/psql -h 192.168.1.151 -U buryan_monitor + -d buryan_monitoring -c 'SELECT cleanup_thin_pool_metrics();' >> /var/log/thin-pool-monitor.log 2>&1 - source: crontab -- schedule: 0 5 * * 0 - command: /root/weekly-backup-cleanup.sh >> /var/log/buryan-hub/backups/cron-cleanup.log + source: cron.d/buryan-monitor +- schedule: 0 * * * * + user: root + command: . /root/.buryan-monitor.env && python3 /opt/buryan-hub/scripts/check_disk.py + >> /var/log/buryan-monitor.log 2>&1 + source: cron.d/buryan-monitoring +- schedule: 30 8 * * * + user: root + command: . /root/.buryan-monitor.env && python3 /opt/buryan-hub/scripts/check_certs.py + >> /var/log/buryan-monitor.log 2>&1 + source: cron.d/buryan-monitoring +- schedule: 30 3 * * 0 + user: root + command: /opt/buryan-hub/scripts/trim-containers.sh + source: cron.d/buryan-trim +- schedule: 15 6 * * * + user: root + command: /usr/local/bin/docker-config-check >> /var/log/docker-config-check.log 2>&1 - source: crontab -- schedule: 30 6 * * * - command: /opt/buryan-hub/scripts/vzdump-rotate.sh >> /var/log/buryan-hub/backups/cron-vzdump-rotate.log + source: cron.d/docker-config-check +- schedule: 10 3 * * * + user: root + command: test -e /run/systemd/system || SERVICE_MODE=1 /sbin/e2scrub_all -A -r + source: cron.d/e2scrub_all +- schedule: 30 3 * * 0 + user: root + command: test -e /run/systemd/system || SERVICE_MODE=1 /usr/libexec/e2fsprogs/e2scrub_all_cron + source: cron.d/e2scrub_all +- schedule: 30 2 * * * + user: root + command: /usr/bin/bash /opt/hub-core/backup.sh >> /var/log/hub-backup.log 2>&1 + source: cron.d/hub-backup +- schedule: 45 2 * * * + user: root + command: /usr/bin/bash /opt/hub-core/backup_bots.sh >> /var/log/hub-backup.log 2>&1 + source: cron.d/hub-backup-bots +- schedule: 5 3 * * * + user: root + command: /bin/bash /opt/hub-core/bots_verify.sh >> /var/log/hub-bots-verify.log 2>&1 - source: crontab + source: cron.d/hub-bots-verify +- schedule: 30 4 * * 0 + user: root + command: /usr/bin/python3 /opt/hub-core/camera_discover.py >> /var/log/hub-cam-scan.log + 2>&1 + source: cron.d/hub-cam-scan +- schedule: 15 4 * * * + user: root + command: set -a; . /etc/hub-core/connectors.env; set +a; /usr/bin/python3 /opt/hub-core/library_sync.py + >> /var/log/hub-catalog.log 2>&1 + source: cron.d/hub-catalog +- schedule: '*/10 * * * *' + user: root + command: set -a; . /etc/hub-core/connectors.env; set +a; /usr/bin/python3 /opt/hub-core/connectors.py + >> /var/log/hub-connectors.log 2>&1 + source: cron.d/hub-connectors +- schedule: '*/30 * * * *' + user: root + command: /opt/music-tools/venv/bin/python /opt/hub-core/device_ident.py >> /var/log/hub-devices.log + 2>&1 + source: cron.d/hub-devices - schedule: 0 9 * * * - command: /root/buryan-infra/ops/audit.sh >> /root/buryan-infra/ops/audit/audit-cron.log + user: root + command: cd /opt/hub-bots && HUB_ENV=/etc/hub-bots/bots.env /usr/bin/python3 digest.py + >> /var/log/hub-digest.log 2>&1 + source: cron.d/hub-digest +- schedule: 30 8 * * * + user: root + command: set -a; . /etc/hub-core/connectors.env; set +a; /usr/bin/python3 /opt/hub-core/events_digest.py + >> /var/log/hub-digest.log 2>&1 + source: cron.d/hub-events-digest +- schedule: 0 23 * * * + user: root + command: /usr/bin/bash /opt/hub-core/export_all.sh >> /var/log/hub-export.log 2>&1 + source: cron.d/hub-export +- schedule: 45 4 * * * + user: root + command: set -a; . /etc/hub-core/connectors.env; set +a; /usr/bin/python3 /opt/hub-core/content_graph.py + >> /var/log/hub-graph.log 2>&1 + source: cron.d/hub-graph +- schedule: 30 23 * * * + user: root + command: /usr/bin/curl -s --max-time 20 http://127.0.0.1:9120/snapshot > /var/log/hub-graph-history.log 2>&1 - source: crontab + source: cron.d/hub-graph-history +- schedule: 0 8 * * 1 + user: root + command: /bin/bash -c 'set -a; . /etc/hub-core/connectors.env; set +a; /usr/bin/python3 + /opt/hub-core/identity_audit.py' >> /var/log/hub-identity.log 2>&1 + source: cron.d/hub-identity +- schedule: 15 */3 * * * + user: root + command: cd /opt/hub-bots && HUB_ENV=/etc/hub-bots/bots.env /usr/bin/python3 reindex.py + >> /var/log/hub-index.log 2>&1 + source: cron.d/hub-index +- schedule: 30 7 * * * + user: root + command: set -a; . /etc/hub-core/connectors.env; set +a; /usr/bin/python3 /opt/hub-core/inventory.py + >> /var/log/hub-inventory.log 2>&1 + source: cron.d/hub-inventory +- schedule: 45 3 * * * + user: root + command: set -a; . /etc/hub-core/connectors.env; set +a; /usr/bin/python3 /opt/hub-core/linker.py + >> /var/log/hub-linker.log 2>&1 + source: cron.d/hub-linker +- schedule: 0 5 * * 0 + user: root + command: /bin/bash /opt/hub-core/lxc_verify.sh >> /var/log/hub-lxc-verify.log 2>&1 + source: cron.d/hub-lxc-verify +- schedule: 20 3 * * * + user: root + command: /bin/bash /opt/hub-core/matrix_verify.sh >> /var/log/hub-matrix-backup.log + 2>&1 + source: cron.d/hub-matrix-backup +- schedule: '*/30 * * * *' + user: root + command: set -a; . /etc/hub-core/connectors.env; set +a; /usr/bin/python3 /opt/hub-core/media_hub.py + >> /var/log/hub-media.log 2>&1 + source: cron.d/hub-media +- schedule: 0 9 * * 1 + user: root + command: set -a; . /etc/hub-core/connectors.env; . /etc/hub-bots/bots.env; . /etc/hub-bots/dm.env; + set +a; NOTIFY_TOKEN="$MEDIA_TOKEN" NOTIFY_ROOM="$MEDIA" /usr/bin/python3 /opt/hub-core/media_digest.py + >> /var/log/hub-media-digest.log 2>&1 + source: cron.d/hub-media-digest +- schedule: 0 6 * * 0 + user: root + command: /bin/bash /opt/hub-core/offsite_verify.sh >> /var/log/hub-offsite-verify.log + 2>&1 + source: cron.d/hub-offsite-verify +- schedule: 40 2 * * * + user: root + command: /bin/bash /opt/hub-core/pg_verify_cron.sh >> /var/log/hub-pg-verify.log + 2>&1 + source: cron.d/hub-pg-verify +- schedule: 30 3 * * * + user: root + command: set -a; . /etc/hub-core/connectors.env; set +a; /usr/bin/python3 /opt/hub-core/reconcile.py + >> /var/log/hub-reconcile.log 2>&1 + source: cron.d/hub-reconcile +- schedule: 0 19 * * * + user: root + command: set -a; . /etc/hub-core/connectors.env; set +a; /usr/bin/python3 /opt/hub-core/resume.py + >> /var/log/hub-resume.log 2>&1 + source: cron.d/hub-resume +- schedule: '*/15 * * * *' + user: root + command: set -a; . /etc/hub-core/telegram.env; set +a; [ -n "$TG_API_ID" ] && /usr/bin/python3 + /opt/hub-core/telegram_userbot.py >> /var/log/hub-telegram.log 2>&1 + source: cron.d/hub-telegram +- schedule: 30 9 * * 1 + user: root + command: cd /opt/hub-bots && HUB_ENV=/etc/hub-bots/bots.env /usr/bin/python3 weekly.py + >> /var/log/hub-weekly.log 2>&1 + source: cron.d/hub-weekly - schedule: 0 20 * * 0 - command: /root/buryan-infra/ops/weekly-report.sh >> /root/buryan-infra/ops/audit/weekly-report.log + user: root + command: set -a; . /etc/hub-core/connectors.env; set +a; /usr/bin/python3 /opt/hub-core/weekly.py + >> /var/log/hub-weekly-core.log 2>&1 + source: cron.d/hub-weekly-core +- schedule: 30 5 * * * + user: root + command: set -a; . /etc/hub-core/connectors.env; set +a; /opt/music-tools/venv/bin/python + /opt/hub-core/sync_users.py 3 >> /var/log/hub-yandex-sync.log 2>&1 + source: cron.d/hub-yandex-music +- schedule: 0 1 * * * + user: root + command: /usr/local/bin/lxc-backup.sh 108 daily >> /var/log/lxc-backup.log 2>&1 + source: cron.d/lxc-backups +- schedule: 0 2 * * * + user: root + command: /usr/local/bin/lxc-backup.sh 155 daily >> /var/log/lxc-backup.log 2>&1 + source: cron.d/lxc-backups +- schedule: 0 3 */2 * * + user: root + command: /usr/local/bin/lxc-backup.sh 110 daily >> /var/log/lxc-backup.log 2>&1 + source: cron.d/lxc-backups +- schedule: 0 4 * * 0 + user: root + command: /usr/local/bin/lxc-backup.sh 105 weekly >> /var/log/lxc-backup.log 2>&1 + source: cron.d/lxc-backups +- schedule: 0 4 */2 * * + user: root + command: /usr/local/bin/lxc-backup.sh 109 daily >> /var/log/lxc-backup.log 2>&1 + source: cron.d/lxc-backups +- schedule: 0 5 * * 0 + user: root + command: /usr/local/bin/lxc-backup.sh 139 weekly >> /var/log/lxc-backup.log 2>&1 + source: cron.d/lxc-backups +- schedule: 0 5 * * 0 + user: root + command: /usr/local/bin/lxc-backup.sh 104 weekly >> /var/log/lxc-backup.log 2>&1 + source: cron.d/lxc-backups +- schedule: 15 5 * * 0 + user: root + command: /usr/local/bin/lxc-backup.sh 111 weekly >> /var/log/lxc-backup.log 2>&1 + source: cron.d/lxc-backups +- schedule: 30 1 * * * + user: root + command: /usr/local/bin/lxc-backup.sh 140 daily >> /var/log/lxc-backup.log 2>&1 + source: cron.d/lxc-backups +- schedule: 30 2 * * * + user: root + command: /usr/local/bin/lxc-backup.sh 115 daily >> /var/log/lxc-backup.log 2>&1 + source: cron.d/lxc-backups +- schedule: 30 3 */2 * * + user: root + command: /usr/local/bin/lxc-backup.sh 114 daily >> /var/log/lxc-backup.log 2>&1 + source: cron.d/lxc-backups +- schedule: 30 4 * * 0 + user: root + command: /usr/local/bin/lxc-backup.sh 113 weekly >> /var/log/lxc-backup.log 2>&1 + source: cron.d/lxc-backups +- schedule: 30 5 * * 0 + user: root + command: /usr/local/bin/lxc-backup.sh 201 weekly >> /var/log/lxc-backup.log 2>&1 + source: cron.d/lxc-backups +- schedule: '*/5 * * * *' + user: root + command: /opt/music-tools/venv/bin/python /opt/hub-core/mesh_watch.py >> /var/log/mesh-watch.log 2>&1 + source: cron.d/mesh-watch +- schedule: 30 3 * * * + user: root + command: /usr/local/bin/backup-n8n >> /var/log/n8n-backup.log 2>&1 + source: cron.d/n8n-backup +- schedule: 24 0 1-7 * * + user: root + command: if [ $(date +\%w) -eq 0 ] && [ -x /usr/lib/zfs-linux/trim ]; then /usr/lib/zfs-linux/trim; + fi + source: cron.d/zfsutils-linux +- schedule: 24 0 8-14 * * + user: root + command: if [ $(date +\%w) -eq 0 ] && [ -x /usr/lib/zfs-linux/scrub ]; then /usr/lib/zfs-linux/scrub; + fi + source: cron.d/zfsutils-linux +- schedule: '* * * * *' + command: /root/buryan-infra/ops/update-manager/update-runner.sh >/dev/null 2>&1 source: crontab + user: root - schedule: 0 */6 * * * command: /root/buryan-infra/ops/scripts/version-watch.sh >> /root/buryan-infra/ops/audit/version-watch.log 2>&1 source: crontab -- schedule: '* * * * *' - command: /root/buryan-infra/ops/update-manager/update-runner.sh >/dev/null 2>&1 - source: crontab -- schedule: 5 3 * * * - command: /root/buryan-infra/ops/update-manager/nightly-report.sh >> /root/buryan-infra/ops/update-manager/runner.log + user: root +- schedule: 0 2 * * * + command: /opt/buryan-hub/scripts/pg-backup-ct151.sh >> /var/log/buryan-hub/backups/cron-pg.log 2>&1 source: crontab -- schedule: 0 6 * * 0 - command: /opt/buryan-hub/scripts/verify-backups.sh >> /var/log/buryan-hub/backups/cron-verify.log + user: root +- schedule: 0 20 * * 0 + command: /root/buryan-infra/ops/weekly-report.sh >> /root/buryan-infra/ops/audit/weekly-report.log 2>&1 source: crontab -- schedule: '*/5 * * * *' - command: /opt/buryan-hub/scripts/check-services.sh >/dev/null 2>&1 + user: root +- schedule: 0 3 * * * + command: /root/matrix-backups/backup-matrix.sh >> /var/log/buryan-hub/backups/cron-matrix.log + 2>&1 source: crontab -- schedule: 30 1 * * * - command: /opt/buryan-hub/scripts/photos-backup.sh >/dev/null 2>&1 + user: root +- schedule: 0 4 * * * + command: /opt/buryan-hub/scripts/offsite-backup.sh >> /var/log/buryan-hub/backups/cron-offsite.log + 2>&1 source: crontab + user: root - schedule: 0 4 * * 0 command: /root/buryan-infra/ops/vpn/vpn-backup-config.sh >> /var/log/buryan-hub/vpn-backup.log 2>&1 source: crontab + user: root +- schedule: 0 5 * * 0 + command: /root/weekly-backup-cleanup.sh >> /var/log/buryan-hub/backups/cron-cleanup.log + 2>&1 + source: crontab + user: root +- schedule: 0 6 * * 0 + command: /opt/buryan-hub/scripts/verify-backups.sh >> /var/log/buryan-hub/backups/cron-verify.log + 2>&1 + source: crontab + user: root - schedule: 0 6 1 * * command: /opt/buryan-hub/scripts/restore-test.sh >> /var/log/buryan-hub/backups/cron-restore-test.log 2>&1 source: crontab -- schedule: 45 3 * * * - command: /usr/local/bin/backup-configs >> /var/log/backup-configs.log 2>&1 - source: backup-configs -- schedule: 0 4 * * 0 - command: /opt/buryan-hub/scripts/cleanup-leftovers.sh >> /var/log/buryan-hub/cleanup-leftovers.log - 2>&1 - source: buryan-cleanup -- schedule: 0 6 * * * - command: for id in $(pct list | tail -n +2 | awk '{print $1}'); do pct exec $id - -- bash -s < /opt/buryan-hub/scripts/fix-logs.sh >/dev/null 2>&1; done - source: buryan-log-hygiene -- schedule: '*/5 * * * *' - command: . /root/.buryan-monitor.env && /usr/bin/python3 /opt/buryan-hub/scripts/check_thin_pool.py - >> /var/log/thin-pool-monitor.log 2>&1 - source: buryan-monitor -- schedule: 0 4 * * * - command: . /root/.buryan-monitor.env && /usr/bin/psql -h 192.168.1.151 -U buryan_monitor - -d buryan_monitoring -c 'SELECT cleanup_thin_pool_metrics();' >> /var/log/thin-p - source: buryan-monitor -- schedule: 0 * * * * - command: . /root/.buryan-monitor.env && python3 /opt/buryan-hub/scripts/check_disk.py - >> /var/log/buryan-monitor.log 2>&1 - source: buryan-monitoring -- schedule: 30 8 * * * - command: . /root/.buryan-monitor.env && python3 /opt/buryan-hub/scripts/check_certs.py - >> /var/log/buryan-monitor.log 2>&1 - source: buryan-monitoring -- schedule: '*/2 * * * *' - command: /usr/bin/python3 /opt/buryan-hub/scripts/export-service-metrics.py >/dev/null - 2>&1 - source: buryan-service-metrics -- schedule: 30 3 * * 0 - command: /opt/buryan-hub/scripts/trim-containers.sh - source: buryan-trim -- schedule: 15 6 * * * - command: /usr/local/bin/docker-config-check >> /var/log/docker-config-check.log - 2>&1 - source: docker-config-check -- schedule: 30 3 * * 0 - command: test -e /run/systemd/system || SERVICE_MODE=1 /usr/libexec/e2fsprogs/e2scrub_all_cron - source: e2scrub_all -- schedule: 10 3 * * * - command: test -e /run/systemd/system || SERVICE_MODE=1 /sbin/e2scrub_all -A -r - source: e2scrub_all -- schedule: 30 2 * * * - command: /usr/bin/bash /opt/hub-core/backup.sh >> /var/log/hub-backup.log 2>&1 - source: hub-backup -- schedule: 45 2 * * * - command: /usr/bin/bash /opt/hub-core/backup_bots.sh >> /var/log/hub-backup.log 2>&1 - source: hub-backup-bots -- schedule: 5 3 * * * - command: /bin/bash /opt/hub-core/bots_verify.sh >> /var/log/hub-bots-verify.log - 2>&1 - source: hub-bots-verify -- schedule: 30 4 * * 0 - command: /usr/bin/python3 /opt/hub-core/camera_discover.py >> /var/log/hub-cam-scan.log - 2>&1 - source: hub-cam-scan -- schedule: 15 4 * * * - command: set -a; . /etc/hub-core/connectors.env; set +a; /usr/bin/python3 /opt/hub-core/library_sync.py - >> /var/log/hub-catalog.log 2>&1 - source: hub-catalog -- schedule: '*/10 * * * *' - command: set -a; . /etc/hub-core/connectors.env; set +a; /usr/bin/python3 /opt/hub-core/connectors.py - >> /var/log/hub-connectors.log 2>&1 - source: hub-connectors -- schedule: '*/30 * * * *' - command: /opt/music-tools/venv/bin/python /opt/hub-core/device_ident.py >> /var/log/hub-devices.log - 2>&1 - source: hub-devices + user: root - schedule: 0 9 * * * - command: cd /opt/hub-bots && HUB_ENV=/etc/hub-bots/bots.env /usr/bin/python3 digest.py - >> /var/log/hub-digest.log 2>&1 - source: hub-digest -- schedule: 30 8 * * * - command: set -a; . /etc/hub-core/connectors.env; set +a; /usr/bin/python3 /opt/hub-core/events_digest.py - >> /var/log/hub-digest.log 2>&1 - source: hub-events-digest -- schedule: 0 23 * * * - command: /usr/bin/bash /opt/hub-core/export_all.sh >> /var/log/hub-export.log 2>&1 - source: hub-export -- schedule: 45 4 * * * - command: set -a; . /etc/hub-core/connectors.env; set +a; /usr/bin/python3 /opt/hub-core/content_graph.py - >> /var/log/hub-graph.log 2>&1 - source: hub-graph -- schedule: 30 23 * * * - command: /usr/bin/curl -s --max-time 20 http://127.0.0.1:9120/snapshot > /var/log/hub-graph-history.log + command: /root/buryan-infra/ops/audit.sh >> /root/buryan-infra/ops/audit/audit-cron.log 2>&1 - source: hub-graph-history -- schedule: 0 8 * * 1 - command: /bin/bash -c 'set -a; . /etc/hub-core/connectors.env; set +a; /usr/bin/python3 - /opt/hub-core/identity_audit.py' >> /var/log/hub-identity.log 2>&1 - source: hub-identity -- schedule: 15 */3 * * * - command: cd /opt/hub-bots && HUB_ENV=/etc/hub-bots/bots.env /usr/bin/python3 reindex.py - >> /var/log/hub-index.log 2>&1 - source: hub-index -- schedule: 30 7 * * * - command: set -a; . /etc/hub-core/connectors.env; set +a; /usr/bin/python3 /opt/hub-core/inventory.py - >> /var/log/hub-inventory.log 2>&1 - source: hub-inventory -- schedule: 45 3 * * * - command: set -a; . /etc/hub-core/connectors.env; set +a; /usr/bin/python3 /opt/hub-core/linker.py - >> /var/log/hub-linker.log 2>&1 - source: hub-linker -- schedule: 0 5 * * 0 - command: /bin/bash /opt/hub-core/lxc_verify.sh >> /var/log/hub-lxc-verify.log 2>&1 - source: hub-lxc-verify -- schedule: 20 3 * * * - command: /bin/bash /opt/hub-core/matrix_verify.sh >> /var/log/hub-matrix-backup.log - 2>&1 - source: hub-matrix-backup -- schedule: '*/30 * * * *' - command: set -a; . /etc/hub-core/connectors.env; set +a; /usr/bin/python3 /opt/hub-core/media_hub.py - >> /var/log/hub-media.log 2>&1 - source: hub-media -- schedule: 0 9 * * 1 - command: set -a; . /etc/hub-core/connectors.env; . /etc/hub-bots/bots.env; . /etc/hub-bots/dm.env; - set +a; NOTIFY_TOKEN="$MEDIA_TOKEN" NOTIFY_ROOM="$MEDIA" /usr/bin/pyth - source: hub-media-digest -- schedule: 0 6 * * 0 - command: /bin/bash /opt/hub-core/offsite_verify.sh >> /var/log/hub-offsite-verify.log - 2>&1 - source: hub-offsite-verify -- schedule: 40 2 * * * - command: /bin/bash /opt/hub-core/pg_verify_cron.sh >> /var/log/hub-pg-verify.log - 2>&1 - source: hub-pg-verify -- schedule: 30 3 * * * - command: set -a; . /etc/hub-core/connectors.env; set +a; /usr/bin/python3 /opt/hub-core/reconcile.py - >> /var/log/hub-reconcile.log 2>&1 - source: hub-reconcile -- schedule: 0 19 * * * - command: set -a; . /etc/hub-core/connectors.env; set +a; /usr/bin/python3 /opt/hub-core/resume.py - >> /var/log/hub-resume.log 2>&1 - source: hub-resume -- schedule: '*/15 * * * *' - command: set -a; . /etc/hub-core/telegram.env; set +a; [ -n "$TG_API_ID" ] && /usr/bin/python3 - /opt/hub-core/telegram_userbot.py >> /var/log/hub-telegram.log 2>&1 - source: hub-telegram -- schedule: 30 9 * * 1 - command: cd /opt/hub-bots && HUB_ENV=/etc/hub-bots/bots.env /usr/bin/python3 weekly.py - >> /var/log/hub-weekly.log 2>&1 - source: hub-weekly -- schedule: 0 20 * * 0 - command: set -a; . /etc/hub-core/connectors.env; set +a; /usr/bin/python3 /opt/hub-core/weekly.py - >> /var/log/hub-weekly-core.log 2>&1 - source: hub-weekly-core -- schedule: 30 5 * * * - command: set -a; . /etc/hub-core/connectors.env; set +a; /opt/music-tools/venv/bin/python - /opt/hub-core/sync_users.py 3 >> /var/log/hub-yandex-sync.log 2>&1 - source: hub-yandex-music -- schedule: 0 1 * * * - command: /usr/local/bin/lxc-backup.sh 108 daily >> /var/log/lxc-backup.log 2>&1 - source: lxc-backups + source: crontab + user: root - schedule: 30 1 * * * - command: /usr/local/bin/lxc-backup.sh 140 daily >> /var/log/lxc-backup.log 2>&1 - source: lxc-backups -- schedule: 0 2 * * * - command: /usr/local/bin/lxc-backup.sh 155 daily >> /var/log/lxc-backup.log 2>&1 - source: lxc-backups -- schedule: 30 2 * * * - command: /usr/local/bin/lxc-backup.sh 115 daily >> /var/log/lxc-backup.log 2>&1 - source: lxc-backups -- schedule: 0 3 */2 * * - command: /usr/local/bin/lxc-backup.sh 110 daily >> /var/log/lxc-backup.log 2>&1 - source: lxc-backups -- schedule: 30 3 */2 * * - command: /usr/local/bin/lxc-backup.sh 114 daily >> /var/log/lxc-backup.log 2>&1 - source: lxc-backups -- schedule: 0 4 */2 * * - command: /usr/local/bin/lxc-backup.sh 109 daily >> /var/log/lxc-backup.log 2>&1 - source: lxc-backups -- schedule: 0 4 * * 0 - command: /usr/local/bin/lxc-backup.sh 105 weekly >> /var/log/lxc-backup.log 2>&1 - source: lxc-backups -- schedule: 30 4 * * 0 - command: /usr/local/bin/lxc-backup.sh 113 weekly >> /var/log/lxc-backup.log 2>&1 - source: lxc-backups -- schedule: 0 5 * * 0 - command: /usr/local/bin/lxc-backup.sh 139 weekly >> /var/log/lxc-backup.log 2>&1 - source: lxc-backups -- schedule: 30 5 * * 0 - command: /usr/local/bin/lxc-backup.sh 201 weekly >> /var/log/lxc-backup.log 2>&1 - source: lxc-backups -- schedule: 0 5 * * 0 - command: /usr/local/bin/lxc-backup.sh 104 weekly >> /var/log/lxc-backup.log 2>&1 - source: lxc-backups -- schedule: 15 5 * * 0 - command: /usr/local/bin/lxc-backup.sh 111 weekly >> /var/log/lxc-backup.log 2>&1 - source: lxc-backups -- schedule: '*/5 * * * *' - command: /opt/music-tools/venv/bin/python /opt/hub-core/mesh_watch.py >> /var/log/mesh-watch.log - 2>&1 - source: mesh-watch + command: /opt/buryan-hub/scripts/photos-backup.sh >/dev/null 2>&1 + source: crontab + user: root - schedule: 30 3 * * * - command: /usr/local/bin/backup-n8n >> /var/log/n8n-backup.log 2>&1 - source: n8n-backup -- schedule: 24 0 1-7 * * - command: if [ $(date +\%w) -eq 0 ] && [ -x /usr/lib/zfs-linux/trim ]; then /usr/lib/zfs-linux/trim; - fi - source: zfsutils-linux -- schedule: 24 0 8-14 * * - command: if [ $(date +\%w) -eq 0 ] && [ -x /usr/lib/zfs-linux/scrub ]; then /usr/lib/zfs-linux/scrub; - fi - source: zfsutils-linux -- schedule: systemd 4min - command: systemd unit hub-mesh.timer - source: systemd -- schedule: systemd 4min - command: systemd unit hub-inbox.timer - source: systemd -- schedule: systemd 5min - command: systemd unit hub-tg-ingest.timer - source: systemd -- schedule: systemd 5min - command: systemd unit hub-selfheal.timer - source: systemd -- schedule: systemd 14min - command: systemd unit hub-agents.timer - source: systemd -- schedule: systemd 14min - command: systemd unit hub-brain.timer - source: systemd -- schedule: systemd 14min - command: systemd unit hub-storage-metrics.timer - source: systemd -- schedule: systemd 1h - command: systemd unit hub-chief.timer - source: systemd -- schedule: systemd 1h - command: systemd unit hub-digest.timer - source: systemd -- schedule: systemd 14h - command: systemd unit hub-pre-prune.timer - source: systemd -- schedule: systemd 16h - command: systemd unit hub-db-dumps.timer - source: systemd -- schedule: systemd 16h - command: systemd unit hub-renovate.timer - source: systemd -- schedule: systemd 17h - command: systemd unit hub-archive-copy.timer - source: systemd -- schedule: systemd 17h - command: systemd unit hub-cert-sync.timer - source: systemd -- schedule: systemd 17h - command: systemd unit hub-vps-backup.timer - source: systemd -- schedule: systemd 17h - command: systemd unit hub-actions.timer - source: systemd -- schedule: systemd 17h - command: systemd unit hub-dl-cleanup.timer - source: systemd -- schedule: systemd 18h - command: systemd unit hub-jf-collections.timer - source: systemd -- schedule: systemd 18h - command: systemd unit hub-updates.timer - source: systemd -- schedule: systemd 19h - command: systemd unit hub-search-index.timer - source: systemd -- schedule: systemd 21h - command: systemd unit hub-nightly-check.timer - source: systemd -- schedule: systemd 21h - command: systemd unit hub-goals.timer - source: systemd -- schedule: systemd 22h - command: systemd unit hub-snap-clean.timer - source: systemd -- schedule: systemd 22h - command: systemd unit hub-snapshot.timer - source: systemd -- schedule: systemd 22h - command: systemd unit hub-finance.timer - source: systemd -- schedule: systemd 3 - command: systemd unit hub-rag.timer - source: systemd -- schedule: systemd 3 - command: systemd unit hub-ct-cleanup.timer - source: systemd -- schedule: systemd 3 - command: systemd unit hub-drill.timer - source: systemd -- schedule: systemd 3 - command: systemd unit hub-second-contour.timer - source: systemd -- schedule: systemd 3 - command: systemd unit hub-integrity.timer - source: systemd -- schedule: systemd 3 - command: systemd unit hub-weekly.timer - source: systemd -- schedule: systemd 4 - command: systemd unit hub-media-maint.timer - source: systemd -- schedule: systemd 5 - command: systemd unit hub-restore-drill.timer - source: systemd -- schedule: каждые 1800с + command: /root/buryan-infra/ops/backup.sh >> /root/buryan-infra/ops/backups/backup.log + 2>&1 + source: crontab + user: root +- schedule: 30 6 * * * + command: /opt/buryan-hub/scripts/vzdump-rotate.sh >> /var/log/buryan-hub/backups/cron-vzdump-rotate.log + 2>&1 + source: crontab + user: root +- schedule: 5 3 * * * + command: /root/buryan-infra/ops/update-manager/nightly-report.sh >> /root/buryan-infra/ops/update-manager/runner.log + 2>&1 + source: crontab + user: root +- name: audit-targets + schedule: ежедневно 07:15 + command: /usr/bin/python3 /opt/buryan-hub/scripts/audit-targets.py + source: hermes +- name: update-plan + schedule: ежедневно 08:45 + command: /opt/music-tools/venv/bin/python /opt/hub-core/update_plan.py + source: hermes +- name: export-service-metrics + schedule: каждые 120 с + command: /usr/bin/python3 /opt/buryan-hub/scripts/export-service-metrics.py + source: hermes +- name: backup-heartbeat + schedule: каждые 1800 с command: /usr/local/bin/backup-heartbeat.sh - source: hermes/backup-heartbeat -- schedule: каждые 21600с + source: hermes +- name: updates-check + schedule: каждые 21600 с command: /opt/music-tools/venv/bin/python /opt/hub-core/check_updates.py - source: hermes/updates-check -- schedule: каждые 3600с + source: hermes +- name: home-heartbeat + schedule: каждые 300 с + command: ssh -o BatchMode=yes -o ConnectTimeout=10 root@193.233.210.184 'date +%s + > /var/lib/home-hb' + source: hermes +- name: direct-health-check + schedule: каждые 300 с + command: /usr/bin/python3 /opt/buryan-hub/scripts/direct-health-check.py + source: hermes +- name: check-services + schedule: каждые 300 с + command: /opt/buryan-hub/scripts/check-services.sh + source: hermes +- name: disk-trend + schedule: каждые 3600 с command: df -h / /mnt/media /mnt/archive | tail -3 - source: hermes/disk-trend -- schedule: каждые 3600с - command: 'curl -s --max-time 20 http://127.0.0.1:9120/status.json | /opt/music-tools/venv/bin/python - -c "import json,sys; d=json.load(sys.stdin); bad=[s[''name''] for s in ' - source: hermes/verify-services + source: hermes +- name: verify-services + schedule: каждые 3600 с + command: curl -s --max-time 20 http://127.0.0.1:9120/status.json | /opt/music-tools/venv/bin/python + -c "import json,sys; d=json.load(sys.stdin); bad=[s['name'] for s in d.get('services',[]) + if not s.get('up')]; print('лежат:', bad or 'нет')" + source: hermes +- name: swarm-watchdog + schedule: каждые 60 с + command: /opt/buryan-hub/scripts/swarm-watchdog.sh + source: hermes +- schedule: '?' + command: apt-daily-upgrade.service + source: systemd + unit: apt-daily-upgrade.timer +- schedule: '?' + command: apt-daily.service + source: systemd + unit: apt-daily.timer +- schedule: '?' + command: dpkg-db-backup.service + source: systemd + unit: dpkg-db-backup.timer +- schedule: '?' + command: e2scrub_all.service + source: systemd + unit: e2scrub_all.timer +- schedule: '?' + command: fstrim.service + source: systemd + unit: fstrim.timer +- schedule: '?' + command: hub-actions.service + source: systemd + unit: hub-actions.timer +- schedule: '?' + command: hub-agents.service + source: systemd + unit: hub-agents.timer +- schedule: '?' + command: hub-archive-copy.service + source: systemd + unit: hub-archive-copy.timer +- schedule: '?' + command: hub-brain.service + source: systemd + unit: hub-brain.timer +- schedule: '?' + command: hub-cert-sync.service + source: systemd + unit: hub-cert-sync.timer +- schedule: '?' + command: hub-chief.service + source: systemd + unit: hub-chief.timer +- schedule: '?' + command: hub-ct-cleanup.service + source: systemd + unit: hub-ct-cleanup.timer +- schedule: '?' + command: hub-db-dumps.service + source: systemd + unit: hub-db-dumps.timer +- schedule: '?' + command: hub-digest.service + source: systemd + unit: hub-digest.timer +- schedule: '?' + command: hub-dl-cleanup.service + source: systemd + unit: hub-dl-cleanup.timer +- schedule: '?' + command: hub-drill.service + source: systemd + unit: hub-drill.timer +- schedule: '?' + command: hub-finance.service + source: systemd + unit: hub-finance.timer +- schedule: '?' + command: hub-goals.service + source: systemd + unit: hub-goals.timer +- schedule: '?' + command: hub-inbox.service + source: systemd + unit: hub-inbox.timer +- schedule: '?' + command: hub-integrity.service + source: systemd + unit: hub-integrity.timer +- schedule: '?' + command: hub-jf-collections.service + source: systemd + unit: hub-jf-collections.timer +- schedule: '?' + command: hub-media-maint.service + source: systemd + unit: hub-media-maint.timer +- schedule: '?' + command: hub-mesh.service + source: systemd + unit: hub-mesh.timer +- schedule: '?' + command: hub-nightly-check.service + source: systemd + unit: hub-nightly-check.timer +- schedule: '?' + command: hub-pre-prune.service + source: systemd + unit: hub-pre-prune.timer +- schedule: '?' + command: hub-rag.service + source: systemd + unit: hub-rag.timer +- schedule: '?' + command: hub-renovate.service + source: systemd + unit: hub-renovate.timer +- schedule: '?' + command: hub-restore-drill.service + source: systemd + unit: hub-restore-drill.timer +- schedule: '?' + command: hub-search-index.service + source: systemd + unit: hub-search-index.timer +- schedule: '?' + command: hub-second-contour.service + source: systemd + unit: hub-second-contour.timer +- schedule: '?' + command: hub-selfheal.service + source: systemd + unit: hub-selfheal.timer +- schedule: '?' + command: hub-snap-clean.service + source: systemd + unit: hub-snap-clean.timer +- schedule: '?' + command: hub-snapshot.service + source: systemd + unit: hub-snapshot.timer +- schedule: '?' + command: hub-storage-metrics.service + source: systemd + unit: hub-storage-metrics.timer +- schedule: '?' + command: hub-tg-ingest.service + source: systemd + unit: hub-tg-ingest.timer +- schedule: '?' + command: hub-updates.service + source: systemd + unit: hub-updates.timer +- schedule: '?' + command: hub-vps-backup.service + source: systemd + unit: hub-vps-backup.timer +- schedule: '?' + command: hub-weekly.service + source: systemd + unit: hub-weekly.timer +- schedule: '?' + command: logrotate.service + source: systemd + unit: logrotate.timer +- schedule: '?' + command: man-db.service + source: systemd + unit: man-db.timer +- schedule: '?' + command: pve-daily-update.service + source: systemd + unit: pve-daily-update.timer +- schedule: '?' + command: xfs_scrub_all.service + source: systemd + unit: xfs_scrub_all.timer diff --git a/ops/scripts/build-automations-registry.py b/ops/scripts/build-automations-registry.py new file mode 100755 index 0000000..c710f89 --- /dev/null +++ b/ops/scripts/build-automations-registry.py @@ -0,0 +1,113 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +"""Собирает реестр автоматизаций из живых источников. + +Источники: crontab root, /etc/cron.d/*, systemd-таймеры, задания Hermes. +Пишет ops/automations/registry.yaml. Ручная правка файла бессмысленна — +он перезаписывается этим скриптом. + + python3 build-automations-registry.py +""" +import os +import re +import subprocess +import sys + +import yaml + +REPO = "/root/buryan-infra" +OUT = os.path.join(REPO, "ops/automations/registry.yaml") +HERMES_JOBS = "/opt/hermes/jobs.yaml" + + +def sh(cmd): + return subprocess.run(cmd, shell=True, capture_output=True, text=True).stdout + + +def crontab_jobs(): + out = [] + for line in sh("crontab -l 2>/dev/null").splitlines(): + line = line.strip() + if not line or line.startswith("#"): + continue + parts = line.split(None, 5) + if len(parts) < 6: + continue + out.append({"schedule": " ".join(parts[:5]), "command": parts[5], "source": "crontab", "user": "root"}) + return out + + +def cron_d_jobs(): + out = [] + base = "/etc/cron.d" + if not os.path.isdir(base): + return out + for name in sorted(os.listdir(base)): + p = os.path.join(base, name) + if not os.path.isfile(p) or "." in name: + continue + try: + text = open(p, encoding="utf-8", errors="ignore").read() + except Exception: + continue + for line in text.splitlines(): + line = line.strip() + if not line or line.startswith("#") or "=" in line.split(None, 1)[0]: + continue + parts = line.split(None, 6) + if len(parts) < 7: + continue + out.append({"schedule": " ".join(parts[:5]), "user": parts[5], "command": parts[6], + "source": "cron.d/" + name}) + return out + + +def systemd_timers(): + out = [] + units = sh("systemctl list-unit-files --type=timer --state=enabled --no-legend 2>/dev/null").split() + for unit in sorted(set(u for u in units if u.endswith(".timer"))): + props = sh(f"systemctl show {unit} -p OnCalendar -p OnUnitActiveSec -p Unit 2>/dev/null") + d = dict(l.split("=", 1) for l in props.splitlines() if "=" in l) + when = d.get("OnCalendar") or d.get("OnUnitActiveSec") or "?" + out.append({"schedule": when.strip(), "command": d.get("Unit", unit.replace(".timer", ".service")), + "source": "systemd", "unit": unit}) + return out + + +def hermes_jobs(): + out = [] + if not os.path.exists(HERMES_JOBS): + return out + data = yaml.safe_load(open(HERMES_JOBS, encoding="utf-8")) or {} + for name, job in data.items(): + if not isinstance(job, dict): + continue + sched = job.get("daily_at") or job.get("every_seconds") + out.append({"name": name, + "schedule": ("ежедневно %s" % sched) if job.get("daily_at") else ("каждые %s с" % sched), + "command": job.get("command"), "source": "hermes"}) + return out + + +def main(): + items = crontab_jobs() + cron_d_jobs() + systemd_timers() + hermes_jobs() + counts = {} + for it in items: + key = it["source"].split("/")[0] + counts[key] = counts.get(key, 0) + 1 + doc = { + "generated": subprocess.run(["date", "+%Y-%m-%d"], capture_output=True, text=True).stdout.strip(), + "generator": "ops/scripts/build-automations-registry.py", + "total": len(items), + "by_source": counts, + "automations": sorted(items, key=lambda x: (x["source"], x.get("schedule", ""))), + } + os.makedirs(os.path.dirname(OUT), exist_ok=True) + with open(OUT, "w", encoding="utf-8") as f: + yaml.safe_dump(doc, f, allow_unicode=True, sort_keys=False) + print("записей:", len(items), "| по источникам:", counts) + return 0 + + +if __name__ == "__main__": + sys.exit(main())