On this page:
remote?
remote
ssh
scp
at-remote
make-sure-remote-is-ready

1 Remote Shells

 (require remote-shell/ssh) package: remote-shell-lib

procedure

(remote? v)  boolean?

  v : any/c
Returns #t if v is a remote-host representation produced by remote, #f otherwise.

procedure

(remote #:host host    
  [#:user user    
  #:env env    
  #:remote-tunnels remote-tunnels    
  #:timeout timeout-secs])  remote?
  host : string?
  user : string? = ""
  env : (listof (cons/c string? string?)) = '()
  remote-tunnels : 
(listof (cons/c (integer-in 1 65535)
                (integer-in 1 65535)))
 = null
  timeout-secs : real? = 600
Creates a representation of a remote host. The host argument specifies the host for an ssh connection. If user is empty, then the current user name is used for the remote host.

The env argument specifies environment variables to set before running any command on the remote host.

The remote-tunnels argument specifies ports to tunnel from the remote host back to the local host. The first port number in each pair is the port number on the remote host, and the second port number is the port that it tunnels to on the local host.

The timeout argument specifies a timeout after which a remote command will be considered failed.

procedure

(ssh remote 
  command 
  [#:mode mode 
  #:failure-log failure-dest 
  #:success-log success-dest 
  #:show-time? show-time?]) 
  (or/c void? boolean? (cons/c boolean? bytes?))
  remote : remote?
  command : (or/c string? path-string?)
  mode : (or/c 'error 'result 'output) = 'error
  failure-dest : (or/c #f path-string?) = #f
  success-dest : (or/c #f path-string?) = #f
  show-time? : any/c = #f
Runs a shell command at remote, were the commands are concatenated (with no additional spaces) to specify the remote shell command. The remote command is implemented with ssh as found by find-system-path.

If mode is 'error, then the result is (void) or an exception is raised if the remote command fails with an connection error, an error exit code, or by timing out. If mode is 'result, then the result is #t for success or #f for failure. If mode is 'cons, then the result is a pair containing whether the command succeeded and a byte string for the command’s output (including error output).

If failure-dest is not #f, then if the command fails, the remote output (including error output) is recorded to the specified file. If success-dest is not #f, then if the command fails, the remote output (including error output) is recorded to the specified file.

procedure

(scp remote source dest [#:mode mode])  (or/c void? boolean?)

  remote : remote?
  source : path-string?
  dest : path-string?
  mode : (or/c 'error 'result 'output) = 'error
Copies a file to/from a remote host. Use at-remote to form either the source or dest argument. The remote command is implemented with scp as found by find-system-path.

If mode is 'error, then the result is (void) or an exception is raised if the remote command fails. If mode is 'result, then the result is #t for success or #f for failure.

procedure

(at-remote remote path)  string?

  remote : remote?
  path : path-string?
Combines remote and path to form an argument for scp to specify a path at the remote host.

procedure

(make-sure-remote-is-ready remote    
  [#:tries tries])  void?
  remote : remote?
  tries : exact-nonnegative-integer? = 3
Runs a simple command at remote to check that it receives connections, trying up to tries times.