printf 'started: %s\n' "$(utcdate)"
(
trap 'kill 0' SIGINT
for REMOTE in "${REMOTES[@]}"
do
ssh -- "$REMOTE" "$COMMAND" "$@" &
done
wait
)
printf 'ended: %s\n' "$(utcdate)"
but twiddling with it has been quite annoying, so I'll look into this tool.Show HN: Sshsync – CLI tool to run shell commands across multiple remote servers
31–40 of 77 posts
Re: Show HN: Sshsync – CLI tool to run shell commands across multiple remote servers
#32For the most common cases I have it aliased to just `p`: https://github.com/Julian/dotfiles/blob/main/.config/zsh/com...
Or https://github.com/Julian/dotfiles/blob/4d36e6b17e9804a887ba...
Re: Show HN: Sshsync – CLI tool to run shell commands across multiple remote servers
#33To me GNU parallel is the top of the line here (as it is for most things parallel). For the most common cases I have it aliased to just `p`: https://github.com/Julian/dotfiles/blob/main/.config/zsh/com... Or https://github.com/Julian/dotfiles/blob/4d36e6b17e9804a887ba...
Re: Show HN: Sshsync – CLI tool to run shell commands across multiple remote servers
#34To me GNU parallel is the top of the line here (as it is for most things parallel). For the most common cases I have it aliased to just `p`: https://github.com/Julian/dotfiles/blob/main/.config/zsh/com... Or https://github.com/Julian/dotfiles/blob/4d36e6b17e9804a887ba...
what is the use case? why wouldn't you use something else (like ansible or puppet or something)? I do not understand why someone would do things like this.
Re: Show HN: Sshsync – CLI tool to run shell commands across multiple remote servers
#35Re: Show HN: Sshsync – CLI tool to run shell commands across multiple remote servers
#36ansible my_servers -m shell -a 'fortune && reboot' -b I know it is easy to be a hater, but sincerely do not see a reason to use something like that over Ansible or just pure sh, ssh and scp. All you have to do is to set up keys and the inventory. Takes 10 minutes, even if you are doing it for the first time. And you can expand it if you need it.
Ansible doesn't work on windows. Stop assuming your method works across the universe of edge cases.
Re: Show HN: Sshsync – CLI tool to run shell commands across multiple remote servers
#37To me GNU parallel is the top of the line here (as it is for most things parallel). For the most common cases I have it aliased to just `p`: https://github.com/Julian/dotfiles/blob/main/.config/zsh/com... Or https://github.com/Julian/dotfiles/blob/4d36e6b17e9804a887ba...
Re: Show HN: Sshsync – CLI tool to run shell commands across multiple remote servers
#38ansible my_servers -m shell -a 'fortune && reboot' -b I know it is easy to be a hater, but sincerely do not see a reason to use something like that over Ansible or just pure sh, ssh and scp. All you have to do is to set up keys and the inventory. Takes 10 minutes, even if you are doing it for the first time. And you can expand it if you need it.
I use pssh often (not this tool, but as I understand is similar). The reasons I find it over Ansible are: - takes the same syntax and options as plain SSH, just run over multiple hosts. So if you already know SSH, you know how to use pssh that is an extension of the command. Ansible requires to study it. The configuration format is trivial, just a file that contains on each line one host, no need to study complex for…
I do agree with your point, sometimes it's just easier to use native tools or simple wrappers around native tools. Use whatever makes your job easier
Re: Show HN: Sshsync – CLI tool to run shell commands across multiple remote servers
#39How are commands handled, that require user input? E.g. password for sudo in your example: sshsync group web-servers "sudo systemctl restart nginx" I like that you included a demo in the README, but it is too long for a gif, as I can't pause/rewind/forward. So splitting into multiple short gifs or converting into a video (if GitHub supports them) could improve the experience.
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.
Re: Show HN: Sshsync – CLI tool to run shell commands across multiple remote servers
#40ansible my_servers -m shell -a 'fortune && reboot' -b I know it is easy to be a hater, but sincerely do not see a reason to use something like that over Ansible or just pure sh, ssh and scp. All you have to do is to set up keys and the inventory. Takes 10 minutes, even if you are doing it for the first time. And you can expand it if you need it.
Ansible requires python to be installed on all of the target computers.