Live data from Hacker News

Show HN: Sshsync – CLI tool to run shell commands across multiple remote servers

github.com

61–70 of 77 posts

Re: Show HN: Sshsync – CLI tool to run shell commands across multiple remote servers

#61
I’m surprised no one has mentioned pdsh yet. Piped to dshbak and output was grouped by response. I’d probably use a config management tool for anything more than simple commands now but that tool was indispensable for managing our fleet, when we used to actually connect to machines.

Re: Show HN: Sshsync – CLI tool to run shell commands across multiple remote servers

#62
post #60

In a past life, this is an interview question that I would ask people: "We have thousands of servers, and you need to run the same command on 10 of them, what's one way you would do it?" and follow up with "What if you wanted to run the command on hundreds or thousands - what problems would you expect with this approach, and what might you do differently?" I didn't really expect them to write code on the spot (hate t…

That's a great question you used in interviews! I'm curious – how would you personally approach this situation? What would your solution be for running a command on 10 servers, and how would you scale it to thousands?

For a handful of servers I would just do a for loop like `for i in {01..10};do echo "command" | ssh -T server$i.example.com;done` because it was quick and dirty and worked fine for something quick, but obviously it doesn't really ensure a common state or handle errors at all (but I still used a for loop like that many times a day for quick stuff like "I wonder what size a specific file is on each server" or "let me quickly grep a config file across a range of servers because I forget which one this thing is running on").

For more than that, I used Puppet at the time (this was a decade and a half ago); I was a contributor to Puppet and standardized on it in my company. Eventually we moved to Ansible and I sold that business but last I heard, they are still using Ansible and likely using playbooks that were ported over from my Puppet stuff

Re: Show HN: Sshsync – CLI tool to run shell commands across multiple remote servers

#63

In a past life, this is an interview question that I would ask people: "We have thousands of servers, and you need to run the same command on 10 of them, what's one way you would do it?" and follow up with "What if you wanted to run the command on hundreds or thousands - what problems would you expect with this approach, and what might you do differently?" I didn't really expect them to write code on the spot (hate t…

Are you still asking this question in an interview? I know a thing or two about sshing into servers, I think I'd be a good enough candidate

Re: Show HN: Sshsync – CLI tool to run shell commands across multiple remote servers

#64

The dry-run option is nice, but you can do this easily in a normal environment without special tooling (GNU parallel, etc). I have made scripts to do this with filter parameters over VMs on cloud providers, which is very valuable. Maybe you can extend this to have those options, so potential users are more attracted to it?

Hey, I missed your comment earlier. And yes, I'd love to hear about those parameters and how they'd be useful

Re: Show HN: Sshsync – CLI tool to run shell commands across multiple remote servers

#65

I'm curious what happens with output. Is it one line per each computer you've connected to or does it get merged until it diverges, kinda like in that Rick and Morty episode with timeline splits?

Haven't set a limit to how many connections are shown, once all the commands are executing, each result (success/failure) is shown at once. So if you connect to 1000 computers, your shell will be flooded with progress bars first and then the output.

Maybe I should set a limit or let the user set a limit to how many results should be shown once the process is completed. Showing m and n results from the start and end

Re: Show HN: Sshsync – CLI tool to run shell commands across multiple remote servers

#66

Earlier quoted context omitted.

As of now there is no way to take user input in transit, so either the user is required to have the privilege to execute the specified command or have passwordless sudo available. And Yeah, now that you've mentioned it multiple shorter gifs would be better.

Or https://asciinema.org/ instead of gifs

I did use asciinema for creating the demo, but since there is no support for it to play in markdown, I went ahead and created a gif using agg.

Re: Show HN: Sshsync – CLI tool to run shell commands across multiple remote servers

#67

Have you looked at what powershell does? Invoke-Command (and the Job stuff it meshes perfectly with via AsJob) is really nice I only needed a very small fraction of what it can do to bail a client out of a problem their customer caused on several hundred computers the night before an event, but it absolutely saved the day and a lot of money.

Haven't really used powershell for my tasks and I'm not as experienced as you are, but what you said sounds absolutely cool, I'll check it out

Re: Show HN: Sshsync – CLI tool to run shell commands across multiple remote servers

#68

I built (and still use) a similar tool called Overcast 10 years ago: https://github.com/andrewchilds/overcast

Dude, your tool does so much than just run ssh commands. I just took a quick glance at your project, just wanted to know does this have support for vultr?

Re: Show HN: Sshsync – CLI tool to run shell commands across multiple remote servers

#69
post #2

This looks great. I've used ansible in the past, is this tool like a stripped down (and thus simpler to use) version of ansible?

To be completely honest, I didn't even think about ansible when creating this (probability because I haven't yet used it), I looked at pssh and clusterssh and just decided to build one myself.

Re: Show HN: Sshsync – CLI tool to run shell commands across multiple remote servers

#70

Earlier quoted context omitted.

well usually it's already in place, right? maybe at home it wouldn't be, but at work, that stuff would already be in place on the stock OS install. and I would be afraid to run SSH commands on multiple machines at once in case one of them errored out and needed manual intervention. ansible or puppet would let me know about that stuff.

If it is already in place, then sure, why not. Not using what is already there would just be a waste, IMO.

I guess I don't understand why running a command in multiple places at once is preferable to running a shell script in four places in sequence.

maybe it's me! there is approximately zero chance that running the same script on four of my machines would result in four cleanly run scripts. one or more would fail, and if more than one failed, they would each fail for a different reason.

Post reply on HN