1 Remote Shells
(require remote-shell/ssh) | package: remote-shell-lib |
procedure
(remote #:host host [ #:kind kind #:user user #:shell shell #:env env #:remote-tunnels remote-tunnels #:key key #:timeout timeout-secs]) → remote? host : string? kind : (or/c 'ip 'docker) = 'ip user : string? = "" shell : (listof string?) = '("/bin/sh" "-c") env : (listof (cons/c string? string?)) = '()
remote-tunnels :
(listof (cons/c (integer-in 1 65535) (integer-in 1 65535))) = null key : (or/c #f path-string?) = #f timeout-secs : real? = 600
The shell argument specifies the command and arguments that are used to prefix a shell string to execute it on the remote host via ssh.
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; it must be '() for a 'docker 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.
If key is not #f, then it is used as the path to an identity file used for public-key authentication for a 'ip host/
The timeout argument specifies a timeout after which a remote command will be considered failed.
Changed in version 1.3 of package remote-shell-lib: Added support for Docker containers, the kind argument, and the shell argument.
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 : any/c 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
If remote’s kind is 'ip and its host is "localhost", then remote’s shell command is used directly.
Otherwise, if remote’s kind is 'ip, then the remote command is run by ssh as found by find-system-path.
If remote’s kind is 'docker, then the remote command is run by docker exec using docker as found by find-system-path. The Docker container named by remote must be started already.
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 'output, 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
The remote copy is implemented with scp as found by find-system-path if remote’s kind is 'ip, and it is implemented with docker cp using docker as found by find-system-path if remote’s kind is 'docker.
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
remote : remote? path : path-string?
procedure
(make-sure-remote-is-ready remote [ #:tries tries]) → void? remote : remote? tries : exact-nonnegative-integer? = 3
procedure
(remote-host remote) → string?
remote : remote?
Added in version 1.2 of package remote-shell-lib.
parameter
(current-ssh-verbose on?) → void? on? : any/c
Added in version 1.3 of package remote-shell-lib.