#!/bin/bash
# Run as root on VPS after deploy.
# Installs (or updates) the systemd timer that triggers scrape schedules every 60s.
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

cp "$SCRIPT_DIR/tradein-scrape-trigger.service" /etc/systemd/system/
cp "$SCRIPT_DIR/tradein-scrape-trigger.timer" /etc/systemd/system/
systemctl daemon-reload
systemctl enable --now tradein-scrape-trigger.timer
systemctl status tradein-scrape-trigger.timer
