#!/bin/bash # vps_fire_and_forget.sh CSV_FILE="vps_data.csv" CMD="$@" if [ -z "$CMD" ]; then echo "Usage: $0 'command'" echo "Example: $0 './capca 104.21.8.239 443'" exit 1 fi echo "=== FIRE AND FORGET - VPS PARALLEL ===" echo "Command: $CMD" echo "" # Count VPS TOTAL_VPS=$(($(wc -l < "$CSV_FILE") - 1)) echo "Total VPS: $TOTAL_VPS" echo "Starting parallel execution..." echo "" counter=0 # Baca CSV dan jalankan SEMUA secara langsung while IFS=',' read -r ip user pass port; do counter=$((counter + 1)) # Skip header if [ $counter -eq 1 ]; then continue fi # Clean ip=$(echo "$ip" | xargs) pass=$(echo "$pass" | xargs) port=$(echo "$port" | xargs) [ -z "$port" ] && port=22 echo -n "[$((counter-1))] Launching $ip... " # FIRE AND FORGET - langsung jalankan di background ( # Cek koneksi cepat if timeout 2 bash -c "echo > /dev/tcp/$ip/$port" 2>/dev/null; then # Execute command timeout 30 sshpass -p "$pass" ssh \ -o StrictHostKeyChecking=no \ -o ConnectTimeout=5 \ -p "$port" \ "root@$ip" "$CMD" 2>/dev/null if [ $? -eq 0 ]; then echo "[$ip] ✅ Done" >> /tmp/vps_results.txt else echo "[$ip] ❌ Failed" >> /tmp/vps_results.txt fi else echo "[$ip] 🔌 Offline" >> /tmp/vps_results.txt fi ) & echo "🚀 FIRED" done < "$CSV_FILE" echo "" echo "════════════════════════════════════════" echo "🎯 ALL VPS LAUNCHED IN PARALLEL!" echo "════════════════════════════════════════" echo "" echo "Commands are running in the background." echo "Check results with:" echo " tail -f /tmp/vps_results.txt" echo "" echo "To see all results later:" echo " cat /tmp/vps_results.txt 2>/dev/null || echo 'No results yet'"