Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Starting a daemon with ssh

953 views
Skip to first unread message

almeidaraf

unread,
May 22, 2008, 1:27:03 PM5/22/08
to
Hello,

I want to run a program in the background of a remote server. I wish
to
use ssh to do it. My first try was:

% ssh server \( program \& \)

It didn't work, ssh would hang. So I tried ssh with the -n option:

% ssh -n server \( program \& \)

It didn't work either. How should I fix that? Isn't there a way for
asking openssh not to wait for output of the program? Maybe I'm
missing
something on the manpage, but I got nothing :(.

[]'s
Rafael

Doug Freyburger

unread,
May 22, 2008, 4:53:42 PM5/22/08
to

"When the only tool you have is a hammer and the
hammer isn't working, make a trip to the toolsmithing
shop."

I write a script on the target host. That script is written
as if it were run by cron without PATH settings, with
IO redirection and so on.

Then I write a small driver script on the target host. All
it does is use nohup to launch the first script in
background then do something sensible about the
"nohup.out" file like change its name over the top of the
previous one so they don't grow without bounds.

Then I use ssh to launch that driver script.

On the other hand - Any chance the program is a network
service? Add it to /etc/inetd.conf or your flavor of UNIX's
equivalent. Better to launch automatically than to have
some other host get no-password permission to do it.

Barry Margolin

unread,
May 22, 2008, 5:41:30 PM5/22/08
to
In article
<c5e09951-4df6-4a6e...@27g2000hsf.googlegroups.com>,
almeidaraf <almei...@gmail.com> wrote:

ssh server 'program </dev/null >/dev/null 2>&1 &'

--
Barry Margolin, bar...@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***

0 new messages