#!/bin/sh # Conductor Server Startup Script # Downloads the server JAR if missing and starts it with java # # Usage: # Interactive: ./conductor_server.sh # With args: ./conductor_server.sh [PORT] [VERSION] # ./conductor_server.sh 9090 3.22.0 # ./conductor_server.sh 9090 # ./conductor_server.sh latest (uses default port 8080) # One-liner: curl -sSL https://raw.githubusercontent.com/conductor-oss/conductor/main/conductor_server.sh | sh # With args: curl ... | sh -s -- 9090 3.22.0 # Check for Java and version 21+ if ! command -v java >/dev/null 2>&1; then echo "Error: Java is not installed or not in PATH" exit 1 fi JAVA_VERSION=$(java -version 2>&1 | head -n 1 | sed -E 's/.*"([0-9]+).*/\1/') if [ -z "$JAVA_VERSION" ] || [ "$JAVA_VERSION" -lt 21 ] 2>/dev/null; then echo "Error: JDK 21 or higher is required. Current version: $(java -version 2>&1 | head -n 1)" exit 1 fi # Defaults SERVER_PORT=8080 CONDUCTOR_VERSION="latest" REPO_URL="https://conductor-server.s3.us-east-2.amazonaws.com" # Argument parsing: check if args are port numbers or versions for arg in "$@"; do if echo "$arg" | grep -q "^[0-9][0-9]*$"; then SERVER_PORT="$arg" else CONDUCTOR_VERSION="$arg" fi done # If running interactively and no args provided, prompt user if [ $# -eq 0 ] && [ -z "$CONDUCTOR_PORT" ] && [ -t 0 ]; then printf "Enter the port for Server [8080]: " read input_port