GithubHelp home page GithubHelp logo

diogo-karma / runoverssh Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yuriescl/runoverssh

0.0 0.0 0.0 42 KB

Run a shell command or script over ssh in one or more hosts.

Shell 88.43% Roff 11.57%

runoverssh's Introduction

Run Over SSH

Run a shell command or script over ssh in one or more hosts.

Installation

Debian/Ubuntu

sudo apt install runoverssh

Manually

sudo curl -L "https://raw.githubusercontent.com/yuriescl/runoverssh/master/runoverssh" -o /usr/local/bin/runoverssh && chmod +x /usr/local/bin/runoverssh

Usage

$ runoverssh [OPTIONS] USERNAME COMMAND HOSTS...

Default behavior

  • SSH flags: -o ConnectTimeout=5 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null
  • Uses bash as the remote shell

Global Password

A global password can be used for all SSH connections. It requires sshpass to be installed.
See the -g flag.

Options:

   -g, --globalpw             Prompt a global password for all connections
   -s, --script FILE          Read commands from a script file, disables
                               the default COMMAND argument
   -r, --hostsfile FILE       Read the list of hosts from a file (one host
                               per line), disables the default HOSTS argument
   -a, --args ARGS            Arguments (in a single string) to be passed to
                               the script file.
   -q, --quiet                Disable all screen output, except for password
                               prompts. If logfile is set, output is written
                               there
   -v, --verbose              Print verbose messages
   --shell SHELL              Remote shell to be used. Supported values:
                               sh, bash
                              default: bash
   --shellflags FLAGS         Remote shell flags
                              default: ''
   --sshflags FLAGS           Local SSH flags
                              default:  -o ConnectTimeout=5
                                        -o StrictHostKeyChecking=no
                                        -o UserKnownHostsFile=/dev/null
   --logfile FILE             Append SSH output to a file

Examples

Restart Apache webserver in two hosts

runoverssh root "systemctl restart apache2" webserver webserver2

Reboot three hosts, which contain the same root password. Writes the SSH output to reboot.log.

runoverssh --logfile reboot.log --globalpw root "reboot" host1 host2 host3

Run puppet agent in all nodes listed in puppet-nodes, supressing the output

runoverssh -q -g -r puppet-nodes root "puppet agent -t"

Check git status on devmachine

runoverssh remoteuser "cd git-project && git status" devmachine

Run backup script in all hosts listed in a file

runoverssh -g --script backup.sh --hostsfile hostlist remoteuser

runoverssh's People

Contributors

imzack avatar yuriescl avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.