Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 09 Nov 2013 12:27:46 +0000
From:      Frank Leonhardt <frank2@fjl.co.uk>
To:        freebsd-questions@freebsd.org
Subject:   Re: Deleting files after download
Message-ID:  <527E2A42.4080903@fjl.co.uk>
In-Reply-To: <20131109103750.1545c9ae.freebsd@edvax.de>
References:  <20131109103750.1545c9ae.freebsd@edvax.de>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On 09/11/2013 09:37, Polytropon wrote:
> I'm searching for a solution for the following scenario and I hope
> there's something already existing that I could use. Maybe someone
> has had a comparable requirement and can share ideas?
>
> For transfering files that do not pass e-mail entry quota, a system
> for file exchange has been installed. It's an "in-house solution",
> but should be usable via Internet as well (security!).
>
> When Alice wants to send a file to Bob, she'd run a command to
> upload the file, like this:
>
> 	$ uploadfor bob catmagazine.ps
>
> The "uploadfor" script would notify Bob about a new file waiting
> for him (via e-mail):
>
> 	Bob,
> 	there is a new file for you to download:
> 	ftp://ftp.example.com/xchg/catmagazine.ps
>
> He can now go ahead and download the file. The choice here is a
> CLI program because it's helpful to automate tasks (upload more
> than one file, scripted uploads, etc.).
>
> After the file has been downloaded, it isn't required to be on the
> server any more time. I'm searching for a solution that can do this
> either
>
> a) right _after_ the download has been completed
>     (I know how to check this in ftpd -ll logs, but I don't want to
>     really use FTP; also both Alice and Bob have an account and will
>     use scp, but how can I check for successful scp transfers?)
>
> b) at a preprogrammed time
>     (A cron job, run once an hour or every day at midnight could do
>     that.)
>
> The side effect of a working solution a) would be that a message
> could be sent to Alice:
>
> 	Alice,
> 	Bob has downloaded xchg/catmagazine.ps at <timestamp>.
> 	The file has been deleted.
>
> I din't really want to use FTP for this (even though it would be
> trivial to implement). Using scp (or any other "FTP via SSH" client)
> would be more secure and therefore better. :-)
>
> It would also be nice to have the "messaging facility" on the same
> system that holds the files for exchange. In the above example,
> the "uploadfor" program would generate the "invitation", while some
> other program would generate the "success report". It would be cool
> to have the exchange server "listening" for arrival of new files
> (for whom, by whom, name, size) and generate the "invitation" from
> that data.
>
> Any ideas? Does this maybe already exist?
>

For what it's worth, in a similar situation I opted for an email 
notification that said "This file will be available for 14 days". Apart 
from being somewhat easier to implement, it had the advantage that the 
file could be downloaded by the same person on two or more hosts, more 
than one recipient to the original email, and it was possible to forward 
the link to other people who might also want the file. I used http/s for 
getting the files up and down as it was just easier for the users 
(especially cross-platform). If you've not done this before, HTTP POST 
and PHP are your friends. If you use PHP for upload, you can make it do 
anything you like on download too. PHP remains, of course, the work of 
Beelzebub and the fact that it's useful at times like this is simply 
proof of its nefariousness.

Regards, Frank.




Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?527E2A42.4080903>