proxmox_choose_page/start.sh
2025-03-31 23:43:55 +02:00

32 lines
969 B
Bash
Executable file

#!/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"