From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ista Zahn Subject: Re: Executing org shell blocks on remote machine over ssh Date: Tue, 18 Nov 2014 13:12:16 -0500 Message-ID: References: <874mtxx18q.fsf@duke.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48715) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqnGa-0000Zt-5r for emacs-orgmode@gnu.org; Tue, 18 Nov 2014 13:12:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XqnGZ-0007Kw-3Q for emacs-orgmode@gnu.org; Tue, 18 Nov 2014 13:12:40 -0500 Received: from mail-oi0-x236.google.com ([2607:f8b0:4003:c06::236]:61161) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqnGY-0007Ka-Uv for emacs-orgmode@gnu.org; Tue, 18 Nov 2014 13:12:39 -0500 Received: by mail-oi0-f54.google.com with SMTP id u20so2943424oif.27 for ; Tue, 18 Nov 2014 10:12:36 -0800 (PST) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Brett Viren Cc: emacs-orgmode Mailinglist , David Bjergaard On Tue, Nov 18, 2014 at 10:43 AM, Brett Viren wrote: > David Bjergaard writes: > >> I use org mode as a lab notebook. I write org-src blocks to keep track >> of tasks I do at the command line, and then I copy paste them into the >> terminal. I would really like to hit "C-c C-c" on the source block and >> have it executed on the remote machine. I know that you can specify >> the remote machine according to [1], however the software I use requires >> a fairly complicated setup to get going. > > Is it just complicated, or is it also prohibitively long-running? > > If just the former, you could maybe bundle the setup into some shell > script and source it in each of your sh source blocks. Eg: > > #+BEGIN_SRC sh :results output :dir /ssh:lycastus:/home/bviren > /bin/pwd > echo $HOSTNAME > ls -l foo.sh > echo "---" > cat foo.sh > echo "---" > source ./foo.sh > echo $FOO > #+END_SRC > > #+RESULTS: > : /home/bviren > : lycastus > : -rw-rw-r-- 1 bviren bviren 16 Nov 18 10:27 foo.sh > : --- > : export FOO=bar > : > : --- > : bar > > > > If the setup is purely environmental, and it takes a long time to > perform, maybe you could do the set up once and then cache the resulting > environment using the output of "env". I guess I'm missing something (like why the OP want's to run a shell in a separate window), but why not just #+BEGIN_SRC sh :results output :dir /ssh:lycastus:/home/bviren :session *shell* /bin/pwd echo $HOSTNAME ls -l foo.sh echo "---" cat foo.sh echo "---" source ./foo.sh echo $FOO #+END_SRC ? Best, Ista > > > -Brett.