Back to articles
Stop SSH-ing One by One: Building a Parallel Command Executor in Bash
How-ToDevOps

Stop SSH-ing One by One: Building a Parallel Command Executor in Bash

via Dev.toAlan Varghese

Learn how to build a robust, multi-server SSH command runner using Bash, Docker, and parallel processing. As developers or system administrators, we've all been there: You need to check the disk space, uptime, or service status on 10 different servers. The "manual" way is painful: ssh user@server1 -> df -h -> exit ssh user@server2 -> df -h -> exit ...repeat 8 more times. 😫 Sure, tools like Ansible exist, but sometimes you just want a lightweight, zero-dependency script to fire off a quick command and see what's happening right now . In this post, I'll walk you through how I built a Multi-Server SSH Executor using pure Bash. We'll explore parallel processing, robust file parsing, and how to simulate a server cluster locally using Docker. 🎯 The Goal We want a script that takes a command (e.g., uptime ) and runs it on a list of servers defined in a config file. Requirements: Parallel Execution: Use threading (background processes) so checking 10 servers takes as long as the slowest one, n

Continue reading on Dev.to

Opens in a new tab

Read Full Article
3 views

Related Articles