Skip to content

Execute binaries or shell scripts on multiple servers over ssh

License

Notifications You must be signed in to change notification settings

tst2005sh/multi-ssh

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

multi-ssh

Execute binaries or shell scripts on multiple servers over ssh, implemented in bash only.

groups

You can define servers in different files in folder 'groups'. A group can be defined using '-g' when starting multi-ssh.sh For example customer1, customer2 or squeezy, rehl6.

Use -g all to run the command or script on all servers.

possible options

  -n|--dry-run                don't run any command, only show them
  -s|--silent                 don't show servernames
  -c|--cron                   show servername only on remote output
  -i|--stdin                  use stdin, even if CMD is not empty

usage examples

Run command uptime on all servers.

multi-ssh.sh -g all uptime

example output:

WARNING: [email protected]:2426 not reachable.
WARNING: [email protected]:2271 not reachable.
### [email protected]:2275 ###
 02:59:54 up 50 days, 12:21,  0 users,  load average: 0.00, 0.00, 0.00
WARNING: [email protected]:2276 not reachable.
### [email protected]:2288 ###
 02:59:59 up 776 days, 19:13,  0 users,  load average: 0.25, 0.07, 0.02
### [email protected]:2272 ###
 03:00:01 up 50 days, 13:43,  1 user,  load average: 1.07, 0.64, 0.51

Pipe and execute a script with /bin/bash on multiple servers.

cat myfancyscript.sh |multi-ssh.sh -g all --stdin /bin/bash

Pipe and execute a script as root adding a parameter.

cat ~/bin/check_timezone-and-datetime.sh |multi-ssh.sh -g customer1 --silent --stdin "sudo /bin/bash -s " 0.debian.pool.ntp.org

multi-scp.sh

Copy a file to multiple servers.

About

Execute binaries or shell scripts on multiple servers over ssh

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%