#!/bin/bash # Check if screen is installed if ! command -v screen &> /dev/null; then echo "Screen is not installed. Please install it first:" echo "sudo apt-get update && sudo apt-get install screen" exit 1 fi # Kill existing screens if they exist screen -X -S proxmox-api quit > /dev/null 2>&1 screen -X -S proxmox-vite quit > /dev/null 2>&1 # Start the Node.js API server echo "Starting API server..." screen -dmS proxmox-api bash -c 'cd /var/www/proxmoxchoose/proxmox_choose_page && npm run server' # Wait a moment to ensure the API server is up sleep 2 # Start the Vite development server echo "Starting Vite server..." screen -dmS proxmox-vite bash -c 'cd /var/www/proxmoxchoose/proxmox_choose_page && npm run dev' # Display running screens echo "Checking running screens..." screen -ls echo "Servers started successfully!" echo "To attach to the screens:" echo " API server: screen -r proxmox-api" echo " Vite server: screen -r proxmox-vite"