From owner-freebsd-questions Tue Dec 18 0:50:29 2001 Delivered-To: freebsd-questions@freebsd.org Received: from catalyst.sasknow.net (catalyst.sasknow.net [207.195.92.130]) by hub.freebsd.org (Postfix) with ESMTP id BB26B37B419 for ; Tue, 18 Dec 2001 00:50:23 -0800 (PST) Received: from localhost (ryan@localhost) by catalyst.sasknow.net (8.11.6/8.11.6) with ESMTP id fBI8qKH31251; Tue, 18 Dec 2001 02:52:20 -0600 (CST) (envelope-from ryan@sasknow.com) X-Authentication-Warning: catalyst.sasknow.net: ryan owned process doing -bs Date: Tue, 18 Dec 2001 02:52:20 -0600 (CST) From: Ryan Thompson X-X-Sender: To: Dave VanAuken Cc: Subject: Re: retrieve and delete remote file via ssh In-Reply-To: Message-ID: <20011218024135.W30898-100000@catalyst.sasknow.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 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