32 lines
884 B
Bash
32 lines
884 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Manual wrapper to start the VNC services on demand.
|
|
# Use this instead of automatic postStartCommand.
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
ROOT="${SCRIPT_DIR%/.*}/.."
|
|
|
|
LOGDIR=/tmp
|
|
OUT_LOG="$LOGDIR/start-vnc.manual.log"
|
|
|
|
echo "Starting VNC services (logs -> $OUT_LOG)"
|
|
|
|
# Ensure underlying start script exists
|
|
if [ ! -x "$SCRIPT_DIR/start-vnc.sh" ] && [ -f "$SCRIPT_DIR/start-vnc.sh" ]; then
|
|
chmod +x "$SCRIPT_DIR/start-vnc.sh" || true
|
|
fi
|
|
|
|
if [ ! -f "$SCRIPT_DIR/start-vnc.sh" ]; then
|
|
echo "Error: start-vnc.sh not found in $SCRIPT_DIR"
|
|
exit 1
|
|
fi
|
|
|
|
# Run the original script in the background and stream logs to the terminal
|
|
nohup bash "$SCRIPT_DIR/start-vnc.sh" >"$OUT_LOG" 2>&1 &
|
|
PID=$!
|
|
echo "start-vnc.sh started with PID $PID"
|
|
echo "Tailing logs (press Ctrl-C to stop tailing):"
|
|
sleep 1
|
|
tail -n +1 -f "$OUT_LOG"
|