From 79e6656b0257e74efac14da6ef878f7359d6a4ca Mon Sep 17 00:00:00 2001 From: ilia Date: Sun, 4 Jan 2026 21:51:50 -0500 Subject: [PATCH] Add deploy-and-watch script for server deployment and log monitoring - Introduced a new `deploy-and-watch.sh` script to automate server deployment and monitor activity logs. - The script initiates the server rebuild in the background and waits for the log file to be created, providing user feedback during the process. - If the log file is not created within a specified timeout, it alerts the user and suggests manual log monitoring options. --- deploy-and-watch.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 deploy-and-watch.sh diff --git a/deploy-and-watch.sh b/deploy-and-watch.sh new file mode 100755 index 0000000..905b730 --- /dev/null +++ b/deploy-and-watch.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# Deploy server and watch activity logs +# Usage: ./deploy-and-watch.sh + +echo "=========================================" +echo "Deploying and watching activity logs" +echo "=========================================" +echo "" + +# Start rebuild in background +echo "Starting server deployment..." +./rebuild.sh prod & +REBUILD_PID=$! + +# Wait for log file to be created (with timeout) +LOG_FILE="/tmp/mirrormatch-server.log" +MAX_WAIT=30 +WAITED=0 + +echo "Waiting for server to start and create log file..." +while [ ! -f "$LOG_FILE" ] && [ $WAITED -lt $MAX_WAIT ]; do + sleep 1 + WAITED=$((WAITED + 1)) + if [ $((WAITED % 5)) -eq 0 ]; then + echo " Still waiting... ($WAITED/$MAX_WAIT seconds)" + fi +done + +if [ ! -f "$LOG_FILE" ]; then + echo "⚠ Warning: Log file not created after $MAX_WAIT seconds" + echo " Check if rebuild.sh completed successfully" + echo " You can manually watch logs later: ./watch-activity.sh $LOG_FILE" + exit 1 +fi + +echo "✓ Log file created: $LOG_FILE" +echo "" +echo "=========================================" +echo "Watching activity logs..." +echo "Press Ctrl+C to stop" +echo "=========================================" +echo "" + +# Watch activity logs +./watch-activity.sh "$LOG_FILE"