[Samba] Purge Trash Fileserver

A. James Lewis james at fsck.co.uk
Tue May 2 13:22:07 UTC 2017

On 02/05/17 13:48, Nico Kadel-Garcia via samba wrote:
> On Tue, Apr 25, 2017 at 9:20 AM, Dario Lesca via samba
> <samba at lists.samba.org> wrote:
>> Il giorno mar, 25/04/2017 alle 09.25 -0300, Carlos A. P. Cunha via
>> samba ha scritto:
>>> Hello
>>> My fileserver is a samba 4.5.4, in Ubuntu 14.04, is all ok.
>>> My question is,
>>> Have the recycle bin enabled, and would like a way to rotate the
>>> files,
>>> already have something today that is via find
>>> Find /mnt/samba -depth -mtime +30 -print -delete
>>> This works however, it will delete the files inside the destination
>>> with
>>> more than 30 days, but this more than 30 days is not when it went to
>>> the
>>> bin but the date of the file, which does not change when it is
>>> deleted .
>>> Examples:
>>> File with date of 2015, was deleted now in 2017, when run the find
>>> it
>>> will erase this file, even if it was deleted on the same day.
>>> What I would like is to see an alternative to find or when it goes
>>> to
>>> the bin it is changed (date) to find it to be correct.
>>> Any idea ?
>> This is what I do for clear my trash:
>> # echo '/usr/sbin/tmpwatch --dirmtime --atime --force $[24*30] /u/samba/cestino/' > /etc/cron.daily/cestino
>> # chmod 755 /etc/cron.daily/cestino
>> The tricks is '--atime', then if you want still use your command with
>> find, you can try '-atime' find option.
> Fortunately, many of us turn mount our filesystems with "-noatime" for
> performance reasons. Not having to write atime to the directory
> information every time you access a file can seriously improve
> performance for some applications.
You could use "relatime", basically this gives you the performance 
benefits of "noatime", but still updates the atime field when the it can 
be done with no performance overhead (such as when the block is being 
updated anyway)... and when the "atime" value is more than a preset time 
old, RHEL defaults to 1 day.

This should be granular enough for what you want.

>> Hope this help
>> Thanks
>> --
>> Dario Lesca
>> (inviato dal mio Linux Fedora 25 Workstation)
>> --
>> To unsubscribe from this list go to the following URL and read the
>> instructions:  https://lists.samba.org/mailman/options/samba

A. James Lewis (james at fsck.co.uk)
"Engineering does not require science. Science helps a lot but people
built perfectly good brick walls long before they knew why cement works."

More information about the samba mailing list