@@ -16,19 +16,25 @@ sudo cp runoverssh/runoverssh /usr/local/bin/runoverssh
1616rm -rf runoverssh
1717```
1818
19- ### Usage:
19+ ### Usage
2020```
2121$ runoverssh [OPTIONS] USERNAME COMMAND HOSTS...
2222```
2323
24- #### Default behavior:
24+ ### Default behavior
2525
2626* Ask each ` username@host ` password at the start
2727* SSH flags ` -o ConnectTimeout=5 -o StrictHostKeyChecking=no `
2828* Bash flags ` -l `
2929* Prints all SSH output in the screen
3030
31- #### Options:
31+ ### SSH Authentication
32+
33+ ` sshpass ` is used for authenticating using a password.
34+ For using SSH directly (no ` sshpass ` ), use the ` --nopw ` /` -n ` flag.
35+ This is useful for SSH public-key authentication.
36+
37+ ### Options:
3238```
3339 -g, --globalpw ask one global password for all connections
3440 -s, --script [file] read commands from a script file instead
@@ -47,8 +53,9 @@ $ runoverssh [OPTIONS] USERNAME COMMAND HOSTS...
4753
4854```
4955
50- #### Examples
56+ ### Examples
5157```
58+ # Restart Apache webserver in two hosts
5259$ runoverssh root "systemctl restart apache2" webserver webserver2
5360Please set root's password for each host:
5461
@@ -59,14 +66,16 @@ Connecting as root@webserver...
5966Connecting as root@webserver2...
6067```
6168```
62- $ runoverssh --log --quiet --globalpw root "reboot" host1 host2 host3
69+ # Reboot three hosts, which contain the same root password. Log the output.
70+ $ runoverssh --log --globalpw root "reboot" host1 host2 host3
6371root's password (used for all connections):
6472
6573Connecting as root@host1...
6674Connecting as root@host2...
6775Connecting as root@host3...
6876```
6977```
78+ # Run puppet agent in all nodes listed in a file supressing output from ssh.
7079$ runoverssh -q -l -g -r puppet-nodes root "puppet agent -t"
7180root's password (used for all connections):
7281
@@ -75,6 +84,7 @@ Connecting as root@node2...
7584Connecting as root@node3...
7685```
7786```
87+ # Check git status on devmachine
7888$ runoverssh remoteuser "cd git-project && git status" devmachine
7989Please set remoteuser's password for each host:
8090
@@ -86,6 +96,7 @@ Your branch is up-to-date with 'origin/master'.
8696nothing to commit, working directory clean
8797```
8898```
99+ # Run backup script in all hosts listed in a file
89100$ runoverssh -g --script backup.sh --hostsfile hostlist remoteuser
90101remoteuser's password (used for all connections):
91102
0 commit comments