[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tailing a file on another server using ssh and...

From: Bob Proulx
Subject: Re: tailing a file on another server using ssh and...
Date: Wed, 18 Jun 2008 13:26:52 -0600
User-agent: Mutt/1.5.13 (2006-08-11)

Tomthemage wrote:
> I'd like to tail a file that's sitting on another server, but simply typing:
> tail address.of.server:/file/to/tail >> output
> doesn't seem to be doing the trick:
> tail: cannot open "address.of.server:/file/to/tail" for reading: No such
> file or directory

Right.  The tail command is expecting a filename there.  You didn't
give it a filename.  You gave it a string that could be a filename on
the local filesystem but probably isn't typical.  There is no reason
that "address.of.server:" can't be a directory.  Try it.  You will see
that the above is potentially a perfectly good local filename.  The
tail program doesn't know anything about rcp-like strings such as the
above.  It only knows about local filesystem filenames.

  mkdir -p address.of.server:/file/to
  date -R > address.of.server:/file/to/tail
  tail address.of.server:/file/to/tail

Since tail couldn't open the file on the local filesystem it reported
the error.

> I'm fairly new to bash and linux in general, so how should I form this?

First, this isn't really a bug-bash issue and so this is off-topic for
this mailing list.  I can't resist trying to help anyway but will keep
the response short.

You seem to know about ssh because you included the name in your
subject line.  Why don't you use ssh to access that file?

> I know how to access this file normally, and I CAN do this by just
> logging onto the server and then typing:
> tail /file/to/tail >> output
> but I, for whatever reason, want to consolidate everything to one statement,
> if possible.

Try using ssh to access the file.

  ssh -n example.com tail /file/to/tail >> output

That will use ssh without reading stdin to the remote host machine and
on the remote host will execute tail of the there file and the stdout
will be appended to output on the local filesystem.

Note that the appending of the output seems suspicious to me.  This
will duplicate the lines if the command is run multiple times.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]