Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Plan] Add subcommand 'fetch' for copying files or dirs from target hosts to local #18

Closed
windvalley opened this issue Jan 7, 2022 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@windvalley
Copy link
Owner

No description provided.

@windvalley windvalley added enhancement New feature or request good first issue Good for newcomers labels Jan 7, 2022
@windvalley windvalley changed the title [Plan] Add subcommand 'fetch' for copying files or dirs from remote hosts to local [Plan] Add subcommand 'fetch' for copying files or dirs from target hosts to local Jan 9, 2022
@windvalley
Copy link
Owner Author

Subcommand fetch first version usage show:

$ gossh fetch -h

Copy files/dirs from target hosts to local.

Usage:
  gossh fetch [flags]

Examples:

  # Copy host1:/path/foo to local /tmp/backup/host1/path/foo.
  $ gossh fetch host1 -f /path/foo -d /tmp/backup

  # Copy files and dirs from target hosts to local dir /tmp/backup/,
  # and files in local dir /tmp/backup/ would be:
  #    /tmp/backup/host1/path1/foo.txt
  #    /tmp/backup/host1/path2/bar/
  #    /tmp/backup/host2/path1/foo.txt
  #    /tmp/backup/host2/path2/bar/
  #
  $ gossh fetch host1 host2 -f /path1/foo.txt -f /path2/bar/ -d /tmp/backup
    or
  $ gossh fetch host1 host2 -f /path1/foo.txt,/path2/bar/ -d /tmp/backup

Flags:
  -d, --dest-path string   local directory that files/dirs from target hosts will be copied to
  -f, --files strings      files/dirs on target hosts that to be copied
  -h, --help               help for fetch

Global Flags:
  -k, --auth.ask-pass                  ask for password of login user
  -a, --auth.file string               file containing the credentials (format: "username:password")
  -i, --auth.identity-files strings    identity files (default $HOME/.ssh/{id_rsa,id_dsa})
  -K, --auth.passphrase string         passphrase of the identity files
  -p, --auth.password string           password of the login user
  -u, --auth.user string               login user (default $USER)
      --config string                  config file (default {$PWD,$HOME}/.gossh.yaml)
  -H, --hosts.file string              file containing target hosts (format: one host/pattern per line)
  -L, --hosts.list                     outputs a list of target hosts, and does not do anything else
  -P, --hosts.port int                 port of target hosts (default 22)
  -C, --output.condense                condense output and disable color
  -o, --output.file string             file to which messages are output
  -j, --output.json                    output messages in json format
  -q, --output.quiet                   do not output messages to screen (except error messages)
  -v, --output.verbose                 show debug messages
      --proxy.identity-files strings   identity files for proxy (default same as 'auth.identity-files')
      --proxy.passphrase string        passphrase of the identity files for proxy
                                       (default same as 'auth.passphrase')
      --proxy.password string          password for proxy (default same as 'auth.password')
      --proxy.port int                 proxy server port (default 22)
  -X, --proxy.server string            proxy server address
      --proxy.user string              login user for proxy (default same as 'auth.user')
  -U, --run.as-user string             run via sudo as this user (default "root")
  -c, --run.concurrency int            number of concurrent connections (default 1)
  -l, --run.lang string                specify i18n while executing command (e.g. zh_CN.UTF-8|en_US.UTF-8)
  -s, --run.sudo                       use sudo to execute commands/script
      --timeout.command int            timeout seconds for executing commands/script on each target host
                                       or copying local files and dirs to each target host
                                       or copying files and dirs from each target host to local
      --timeout.conn int               timeout seconds for connecting each target host (default 10)
      --timeout.task int               timeout seconds for the current gossh task

@windvalley
Copy link
Owner Author

windvalley commented Jan 10, 2022

Add fetch demo screenshot:

  1. Success(at least one file or dir is valid):

image

  1. Failed(all files or dirs not exist):

image

  1. Failed(all files or dirs no permission):

image

  1. Failed(command 'zip' not installed on target hosts):

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant