I am working on an automated report using R Markdown which shows retention profile plots for which I am querying data from Redshift. Since I need to ssh into my connection I figured I'd add my ssh commands as a bash command in my markdown script. I checked to make sure simple commands work (e.g., cd, mkdir) which all work fine but it seems to get stuck on the ssh command.
Does anybody have an idea whether this does not work because of the ssh command or because of R markdown/ knitr (it works fine if I paste my ssh code in my terminal). It can recognise the ssh command when I just type ssh
but it gets stuck when I specify the ports/endpoints. I'm afraid I cannot share a reproducible example without sharing my ssh specs.
---
title: "example script"
author: "Tim Faber"
date: "1/29/2018"
output: html_document
runtime: shiny
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Create ssh tunnel
```{r, engine='bash'}
ssh -N -L portid:datasource:portid ubuntu@..
```
Sorry, I think my answer is largely incomplete, but I hope it could help.
As you, I cannot achieve to create a SSH tunnel. I think that
bash
chunks are not persistent, so I wonder how it would be possible to create such a connexion.However, I succeed in sending remote commands:
I don't use Redshift myself, and I don't know if you can achieve your task with ssh remote commands.