#!/bin/bash
# Refresh PeeringDB SQLite mirror daily

LOG=/var/log/peercortex/peeringdb-refresh.log
mkdir -p /var/log/peercortex
exec >> $LOG 2>&1

echo "[$(date +%Y-%m-%dT%H:%M:%S)] Starting PeeringDB sync..."
cd /opt/peeringdb-data
peeringdb sync -q
echo "[$(date +%Y-%m-%dT%H:%M:%S)] Sync complete. File: $(du -sh peeringdb.sqlite3 | cut -f1)"
