My-Weekly-ToDo-List/scripts/boot-update.sh
mARTin dea7c387ea v1.7.0: Responsive mobile layout + boot update script
- Add responsive CSS breakpoints (480px/768px/1024px)
- Auto-adjust viewDays based on screen width
- Keep time column visible on mobile (compact)
- Add boot-update.sh for auto-update on reboot
- Fix Suspense boundary in verify-email page
- Bump version to 1.7.0
2026-02-27 13:03:25 +01:00

51 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# Boot Update Script: Automatically pull latest main, build, and prepare for PM2
# This script runs on LXC container boot BEFORE PM2 starts.
# It ensures the app is always up-to-date with the main branch.
set -e
APP_DIR="/root/My-Weekly-ToDo-List"
LOG_FILE="/var/log/app-boot-update.log"
log() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" | tee -a "$LOG_FILE"
}
log "=== Boot update started ==="
cd "$APP_DIR"
# Check if there are remote changes
log "Fetching from origin..."
git fetch origin main 2>&1 | tee -a "$LOG_FILE"
LOCAL=$(git rev-parse HEAD)
REMOTE=$(git rev-parse origin/main)
if [ "$LOCAL" = "$REMOTE" ]; then
log "Already up-to-date. No rebuild needed."
log "=== Boot update finished (no changes) ==="
exit 0
fi
log "Changes detected. Updating from $LOCAL to $REMOTE"
log "Pulling latest changes..."
git checkout main 2>&1 | tee -a "$LOG_FILE"
git pull origin main 2>&1 | tee -a "$LOG_FILE"
log "Installing dependencies..."
npm install 2>&1 | tee -a "$LOG_FILE"
log "Updating database schema..."
npx prisma db push 2>&1 | tee -a "$LOG_FILE"
log "Regenerating Prisma client..."
npx prisma generate 2>&1 | tee -a "$LOG_FILE"
log "Building application..."
npm run build 2>&1 | tee -a "$LOG_FILE"
log "=== Boot update finished (rebuilt successfully) ==="