diff --git a/scripts/test-failover.sh b/scripts/test-failover.sh index 0ed88c5..18ee1a5 100755 --- a/scripts/test-failover.sh +++ b/scripts/test-failover.sh @@ -71,11 +71,27 @@ else fi echo "" -echo "6. Test servizi FTP:" -if timeout 5 bash -c "echo quit | nc $VIP 21" &>/dev/null; then - echo -e " ${GREEN}✓ FTP risponde${NC}" +echo "6. Test servizi FTP e SFTP:" + +# Test FTP (porta 21) - verifica solo che il server risponda +if timeout 2 bash -c "echo -e 'QUIT\r' | nc -w 1 $VIP 21 2>/dev/null | grep -q '220'" 2>/dev/null; then + echo -e " ${GREEN}✓ FTP risponde sulla porta 21${NC}" else - echo -e " ${YELLOW}⚠ FTP non risponde (potrebbe essere normale)${NC}" + echo -e " ${RED}✗ FTP non risponde${NC}" +fi + +# Test SFTP (porta 22) - verifica che il server SSH/SFTP risponda +if timeout 2 bash -c "echo '' | nc -w 1 $VIP 22 2>/dev/null | grep -q 'SSH'" 2>/dev/null; then + echo -e " ${GREEN}✓ SFTP risponde sulla porta 22${NC}" +else + echo -e " ${RED}✗ SFTP non risponde${NC}" +fi + +# Test MySQL (porta 3306) - verifica che il server risponda +if timeout 2 bash -c "echo '' | nc -w 1 $VIP 3306 2>/dev/null" >/dev/null 2>&1; then + echo -e " ${GREEN}✓ MySQL risponde sulla porta 3306${NC}" +else + echo -e " ${RED}✗ MySQL non risponde${NC}" fi echo ""