Simple program to exec command remotely in multiple server using ssh.
if you use MacOS, you can use brew
https://brew.shthen after brew installed, please install wget
brew install wgetthen you can directly install this repository
wget https://github.com/hendrap259/rexec/raw/master/rexecgit clone https://github.com/hendrap259/rexec
go mod init github.com/hendrap259/rexec
go mod tidy
go buildthen you can move the output binary into your /usr/local/bin
mv rexec /usr/local/bin/rexecrexec [-e | -h <hosts>|-g <group>] <command>
# example of executing command remotely
# single server
rexec -h root@192.168.100.160 tail -f /var/log/nginx/access.log
# multiple server
rexec -h root@192.168.100.160,root@192.168.100.161 zgrep 500 /var/log/nginx/access.log.1.gz
# using file config
rexec grep 500 /var/log/nginx/access.log
# edit file config
rexec -ePut host config to be line separated. example:
root@192.168.0.123
root@192.168.0.124
or you can group it. example:
[server1]
root@192.168.0.1
root@192.168.0.2
[other-server]
root@192.168.0.3
root@192.168.0.4