scpm

package module
v0.0.0-...-a5e1621 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2015 License: MIT Imports: 13 Imported by: 0

README

Scpm

Copy files over ssh protocol to multiple servers, scp multiplexer.

Demo

scpm --in="~/Video/dog-team09012015.mp4" --path="example1.com:/tmp/a" --path="example2.com:/tmp/b"
Start copy /home/gron/Video/dog-team09012015.mp4
example1.com:22 /tmp/a 5.59 MB / 109.99 MB [=>-----------------------------] 5.09 % 1.12 MB/s 1m33s
example2.com:22 /tmp/b 5.69 MB / 109.99 MB [=>-----------------------------] 5.17 % 1.14 MB/s 1m31s

Install

go get github.com/gophergala/scpm/cmd/scpm

Usage

scpm --in="/path/to" \
    --path="user@server0.com:/path/to" \
    --path="user@server1.com:/path/to" \
    --path="user@server2.com:/path/to" \
    --path="user@server3.com:/path/to" \
    --path="user@server4.com:/path/to"

Features

  1. Copy once file to once server
  2. Copy once file to multiple servers
  3. Recursive copy folder to multiple server
  4. Multi progress bar
  5. Support custom identity key, system identity, or plain password

TODO

  1. Flag config.json

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	Info os.FileInfo
	Dir  string
}

type Host

type Host struct {
	User   string
	Addr   string
	Output string
	Client *ssh.Client

	Identity *ssh.ClientConfig
	// contains filtered or unexported fields
}

func NewHost

func NewHost(host string, key string, port int) (h *Host, err error)

func (*Host) Auth

func (h *Host) Auth() error

func (*Host) Copy

func (h *Host) Copy(tree *Tree, wg *sync.WaitGroup, bar *pb.ProgressBar)

func (Host) String

func (h Host) String() string

type Scp

type Scp struct {
	// contains filtered or unexported fields
}

func New

func New(hosts []*Host, path string) (scp *Scp, err error)

func (*Scp) Run

func (s *Scp) Run(quit chan bool)

type Tree

type Tree struct {
	BaseDir string
	Size    int64
	Files   []File
}

func NewTree

func NewTree(path string) (t *Tree, err error)

func (*Tree) Scan

func (t *Tree) Scan(path string, fileInfo os.FileInfo, errInp error) (err error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL