Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Dec 2001 02:52:20 -0600 (CST)
From:      Ryan Thompson <ryan@sasknow.com>
To:        Dave VanAuken <dave@hawk-systems.com>
Cc:        <freebsd-questions@FreeBSD.ORG>
Subject:   Re: retrieve and delete remote file via ssh
Message-ID:  <20011218024135.W30898-100000@catalyst.sasknow.net>
In-Reply-To: <DBEIKNMKGOBGNDHAAKGNAEPKKOAA.dave@hawk-systems.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Dave VanAuken wrote to freebsd-questions@FreeBSD.ORG:

> Am looking to do the following, can't put my finger on it.
>
> Goal:
> scp or rsync file(s) from remote server, then remove them from
> remote server
>
>
> [...]
>
> Problem:
> Getting files over is not an issue, but deleting or 0-lengthing
> the file after it has been retrieved to avoid duplicate entries
> is...  not sure how to go about this and have been staring at the
> problem for too long for it to click.

Ideas, in no particular order, nor with any guarantee of suitability:

You might be able to convince rsync, with a ``special'' command, to
delete the file from the server. Since commands are executed by the
client, the client would actually have to make a remote call (via
ssh). I suppose that would be fairly trivial, but performance might be
quite poor. I don't know, I've never tried it.

You might consider distributing files for machines on a per-directory
basis (one directory per machine), to avoid collisions... then you can
just have the server clean up expired files periodically.

If the machines are close, you might also consider an NFS mount that
all the machines could write to. The client scripts would have to be
somewhat careful to avoid race conditions. This actually wouldn't be
hard to do, if the distributed files are small in number. (i.e., you
don't need all the power and glory of the rdist algorithm). If the
machines poll for new info, they can just check the mtime of the
directory in their polling loop. If you want to initiate a push from
the server, you could probably write to a flag file to boot a select()
in the appropriate client (and there are many other ways to accomplish
the same feat).

If you want the coolest system in your netblock, write some simple
client/server code (something under inetd, even) to provide a simple
control protocol. This might be easier than you think, but perhaps not
as easy as NFS. You don't have to re-invent the wheel with
transport... just use scp.

- Ryan


> Appreciate any pointers.  Am using SSH with keys.
>
> Dave
>
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message
>

-- 
  Ryan Thompson <ryan@sasknow.com>
  Network Administrator, Accounts

  SaskNow Technologies - http://www.sasknow.com
  #106-380 3120 8th St E - Saskatoon, SK - S7H 0W2

        Tel: 306-664-3600   Fax: 306-664-1161   Saskatoon
  Toll-Free: 877-727-5669     (877-SASKNOW)     North America


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011218024135.W30898-100000>