Categorygithub.com/discoriver/massh
modulepackage
2.0.1+incompatible
Repository: https://github.com/discoriver/massh.git
Documentation: pkg.go.dev

# README

logo

Go Report Card Go Report Card Go Doc

Description

Go package for running Linux distributed shell commands via SSH.

Why?

I wanted to experiment with distributed SSH commands, and provide a functional replacement for the old, stale omnissh repository.

Example:

package main

import "github.com/discoriver/massh"

func main() {
	// Create pointers to config & job
	config := &massh.Config{}
	job := &massh.Job{
		Command: "echo hello world",
	}
	
	config.SetHosts([]string{"host1", "host2"})
	
	err := config.SetPublicKeyAuth("~/.ssh/id_rsa")
	if err != nil {
		panic(err)
	}
	
	config.SetJob(job)
	config.SetWorkerPool(2)
	
        // Make sure config will run
        config.CheckSanity()

	config.Run()
}

Usage:

Get the massh package;

go get github.com/DiscoRiver/massh/massh

Documentation

When specifying a script, it's contents will be added to stdin, and then the following command will be executed to run it on the remote machine;

cat > outfile.sh && chmod +x ./outfile.sh && ./outfile.sh && rm ./outfile.sh

# Variables

No description provided by the author

# Structs

Config is a config implementation for distributed SSH commands.
Job is the remote task config.
Result contains usable output from SSH commands.