Files
boc/intelligence/competitor-watch/scripts/alert.sh
T
Bernt 1d80f13ce5 feat(intelligence): add competitor watch system
- Weekly automated scraping of 10 competitors
- Structured data storage (competitors.json)
- Validation and alerting scripts
- First weekly report (2026-07-11) with 4 critical findings:
  1. Premise Data acquired by Culmen (Aug 2025)
  2. Streetbees bankruptcy (Aug 2025)
  3. Moody's/Cape Analytics integration progressing
  4. Sweden Platform Work Act proposed (Dec 2026)
- Cron scheduled for Saturdays 07:00 UTC
2026-07-11 08:33:06 +00:00

59 lines
1.3 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Alert-skript för kritiska konkurrensförändringar
# Skickar notis vid viktiga händelser
set -euo pipefail
WORKSPACE="/home/bernt/.openclaw/workspace"
WATCH_DIR="$WORKSPACE/intelligence/competitor-watch"
DATE=$(date +%Y-%m-%d)
ALERT_LEVEL="${1:-info}" # info, warning, critical
MESSAGE="${2:-}"
# Färger för terminal
RED='\033[0;31m'
YELLOW='\033[1;33m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
echo "=== Konkurrens-alert — $DATE ==="
echo "Nivå: $ALERT_LEVEL"
echo ""
# Logga alerten
LOG_FILE="$WATCH_DIR/data/alerts.log"
echo "$(date -Iseconds) [$ALERT_LEVEL] $MESSAGE" >> "$LOG_FILE"
# Visa alert
case "$ALERT_LEVEL" in
critical)
echo -e "${RED}🚨 KRITISK ALERT${NC}"
echo "$MESSAGE"
echo ""
echo "Åtgärd krävs OMGÅENDE. Meddela Erik."
;;
warning)
echo -e "${YELLOW}⚠️ VARNING${NC}"
echo "$MESSAGE"
echo ""
echo "Övervaka situationen. Uppdatera vid nästa revision."
;;
*)
echo -e "${GREEN}️ INFO${NC}"
echo "$MESSAGE"
;;
esac
# Spara alert till fil för historik
ALERT_FILE="$WATCH_DIR/data/alerts/${DATE}_${ALERT_LEVEL}.txt"
mkdir -p "$(dirname "$ALERT_FILE")"
cat > "$ALERT_FILE" << EOF
Datum: $(date -Iseconds)
Nivå: $ALERT_LEVEL
Meddelande: $MESSAGE
EOF
echo ""
echo "Alert loggad: $LOG_FILE"