#!/bin/bash # Quick update script - rebuild and reload after code changes echo "=== Updating Site ===" # 1. Rebuild frontend echo "1. Building frontend..." cd /media/pts/Website/Church_HOP_MusicData/new-site/frontend npm run build if [ $? -ne 0 ]; then echo "✗ Build failed!" exit 1 fi # 2. Restart backend (picks up new code) echo "2. Restarting backend..." lsof -ti:8080 | xargs kill -9 2>/dev/null cd /media/pts/Website/Church_HOP_MusicData/new-site/backend node server.js > /tmp/backend.log 2>&1 & echo " Backend restarted (PID: $!)" # 3. Reload Nginx echo "3. Reloading Nginx..." sudo systemctl reload nginx sleep 2 # 4. Test echo "" echo "=== Testing ===" if curl -s https://houseofprayer.ddns.net/api/lists > /dev/null 2>&1; then echo "✓ Site is working" echo "" echo "Visit: https://houseofprayer.ddns.net" else echo "✗ Site has issues" tail -10 /tmp/backend.log fi