#!/bin/bash

# Simple helper to start services manually on Linux (VPS/Local)
# Usage: ./bin/linux-start.sh

echo "Starting Crypto Algo Platform..."
echo "-------------------------------"

# Ensure runtime dir exists
mkdir -p storage/runtime
mkdir -p storage/logs

# Start Market Data
echo "Starting Market Data Service..."
nohup php bin/market-data-runner.php > storage/logs/market-data.log 2>&1 &
echo $! > storage/runtime/market-data.pid
echo "PID: $(cat storage/runtime/market-data.pid)"

# Start Trade Monitor
echo "Starting Trade Monitor..."
nohup php bin/trade-monitor-runner.php > storage/logs/trade-monitor.log 2>&1 &
echo $! > storage/runtime/trade-monitor.pid
echo "PID: $(cat storage/runtime/trade-monitor.pid)"

# Start Telegram Bot
echo "Starting Telegram Bot..."
nohup php bin/telegram-bot-runner.php > storage/logs/telegram-bot.log 2>&1 &
echo $! > storage/runtime/telegram-bot.pid
echo "PID: $(cat storage/runtime/telegram-bot.pid)"

echo "-------------------------------"
echo "All services started in background."
echo "Check storage/logs/ for output."
echo "Use 'cat storage/runtime/*.pid' to see Process IDs."
