ssh_teardown: Teardown SSH

Description Usage Value Examples

View source: R/outsider.R

Description

Disconnect from a remote host and stop commands being transferred.

Usage

1

Value

logical

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
library(outsider)

# To forward all Docker commands to a remote host:
# 1. Gain ssh access to a remote host
# 2. Ensure Docker is running on the remote machine
# 3. Supply the IP address and authentication args to ssh::ssh_connect
ip_address <- NULL

if (!is.null(ip_address)) {
  # Create an ssh session
  session <- ssh::ssh_connect(host = ip_address)
  
  # Setup the session for running outsider
  ssh_setup(session)
}

# After setup, run outsider as normal

# simplest repo
repo <- 'dombennett/om..hello.world'

if (is_module_installed(repo = repo)) {
  # import
  hello_world <- module_import(fname = 'hello_world', repo = repo)
  
  # run function
  hello_world()
}

# Always ensure to disconnect after a session
if (!is.null(ip_address)) {
  ssh_teardown()
}

outsider documentation built on Dec. 15, 2020, 5:19 p.m.