Re: [Samba] vfs_recycle folder limit management

2013-09-26 Thread Thomas Harold

On 9/26/2013 10:24 AM, Kevin Field wrote:


Thanks John, but I meant more so is there a way to have it look at the
total size of the recycle dir too?  I.e. only delete stale files when it
needs to to stay within a limit, and also even delete not-so-stale files
if it needs to because there have been too many GB deleted lately to
keep 30 days worth (or whatever) around?



The easiest way would be to do a for loop in bash that starts at say 90 
days, does the "find/remove" command at the 90+ day mark, then checks 
the output of "du -cks /path/to/recycle/bin".  Once you get below the 
target kilobytes, you break out of the loop.  Otherwise you lower your 
target mtime value (by 1 or by 7), delete some more files, and check again.


So nothing in the recycle bin would be older then 90 days, and it would 
always stay below your target size.


--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


Re: [Samba] vfs_recycle folder limit management

2013-09-26 Thread Taylor, Jonn

On 09/26/2013 08:47 AM, Kevin Field wrote:

Hi all,

Running SerNet Samba 4.0.9 on CentOS 6.4 serving as an AD DC and 
fileshare for XP clients.


Added recycler per the example at 
https://wiki.samba.org/index.php/Frequently_Asked_Questions to my 
smb.conf.  Works great.


My concern is that the recycle dir will eventually grow large. 
vfs_recycle's docs mention a parameter for limiting individual file 
sizes, but what's a best practice to prevent the whole recycle folder 
from growing too large?  Cronjob to delete old files when the total is 
past a certain size?  Anyone have a script handy?  (I'm hoping I'm not 
the only one with this problem :) Seems like it would be a common 
concern...)


Thanks,
Kev

I use a script to cleanup the deleted files and run it daily with cron.

cat /usr/bin/cleanupold

#!/bin/bash
find /var/share/.recycle/* -mtime +30 -exec rm {} \;

In /var/spool/cron/root

@daily/usr/bin/cleanupold > /dev/null 2>&1 #Cleanup old audio files


Jonn

--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


Re: [Samba] vfs_recycle folder limit management

2013-09-26 Thread Taylor, Jonn

On 09/26/2013 09:44 AM, Kevin Field wrote:

On 2013-09-26 10:37 AM, Taylor, Jonn wrote:

On 09/26/2013 09:24 AM, Kevin Field wrote:



On 2013-09-26 10:20 AM, Taylor, Jonn wrote:

On 09/26/2013 08:47 AM, Kevin Field wrote:

Hi all,

Running SerNet Samba 4.0.9 on CentOS 6.4 serving as an AD DC and
fileshare for XP clients.

Added recycler per the example at
https://wiki.samba.org/index.php/Frequently_Asked_Questions to my
smb.conf.  Works great.

My concern is that the recycle dir will eventually grow large.
vfs_recycle's docs mention a parameter for limiting individual file
sizes, but what's a best practice to prevent the whole recycle folder
from growing too large?  Cronjob to delete old files when the 
total is
past a certain size?  Anyone have a script handy?  (I'm hoping I'm 
not

the only one with this problem :) Seems like it would be a common
concern...)

Thanks,
Kev
I use a script to cleanup the deleted files and run it daily with 
cron.


cat /usr/bin/cleanupold

#!/bin/bash
find /var/share/.recycle/* -mtime +30 -exec rm {} \;

In /var/spool/cron/root

@daily/usr/bin/cleanupold > /dev/null 2>&1 #Cleanup old audio 
files



Jonn


Thanks John, but I meant more so is there a way to have it look at the
total size of the recycle dir too?  I.e. only delete stale files when
it needs to to stay within a limit, and also even delete not-so-stale
files if it needs to because there have been too many GB deleted
lately to keep 30 days worth (or whatever) around?

Thanks again,
Kev

This will find files larger than 50MB.

find /var/share/.recycle/* -type f -size +5k -exec rm {} \;

Look at the man pages for find to get more options.

Jonn


Hmm...that's a bit closer, but not exactly.  Maybe I described it 
better on stackexchange...let me copy:



I found tmpwatch, but it's only time-based. What I'd like the system to
do is keep files as long as it reasonably can, i.e., without too much
space being taken up. The flip side is that I also don't want it keeping
files too long if it means running out of space. Thus I'm looking for
something with roughly this thinking:

1. if bin_size < limit then quit
2. delete oldest file in bin
3. goto 1.

Of course there may be a more efficient algorithm, and it could be
tweaked to prefer deleting bigger files unless they're past a certain
age so that a big delete doesn't unnecessarily result in the pruning of
a bunch of older-but-not-too-old small files.
[/quote]

Maybe I'm getting too complicated?

Thanks,
Kev

This should get you going. https://bbs.archlinux.org/viewtopic.php?id=69864

Jonn

--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


Re: [Samba] vfs_recycle folder limit management

2013-09-26 Thread Taylor, Jonn

On 09/26/2013 09:24 AM, Kevin Field wrote:



On 2013-09-26 10:20 AM, Taylor, Jonn wrote:

On 09/26/2013 08:47 AM, Kevin Field wrote:

Hi all,

Running SerNet Samba 4.0.9 on CentOS 6.4 serving as an AD DC and
fileshare for XP clients.

Added recycler per the example at
https://wiki.samba.org/index.php/Frequently_Asked_Questions to my
smb.conf.  Works great.

My concern is that the recycle dir will eventually grow large.
vfs_recycle's docs mention a parameter for limiting individual file
sizes, but what's a best practice to prevent the whole recycle folder
from growing too large?  Cronjob to delete old files when the total is
past a certain size?  Anyone have a script handy?  (I'm hoping I'm not
the only one with this problem :) Seems like it would be a common
concern...)

Thanks,
Kev

I use a script to cleanup the deleted files and run it daily with cron.

cat /usr/bin/cleanupold

#!/bin/bash
find /var/share/.recycle/* -mtime +30 -exec rm {} \;

In /var/spool/cron/root

@daily/usr/bin/cleanupold > /dev/null 2>&1 #Cleanup old audio files


Jonn


Thanks John, but I meant more so is there a way to have it look at the 
total size of the recycle dir too?  I.e. only delete stale files when 
it needs to to stay within a limit, and also even delete not-so-stale 
files if it needs to because there have been too many GB deleted 
lately to keep 30 days worth (or whatever) around?


Thanks again,
Kev

This will find files larger than 50MB.

find /var/share/.recycle/* -type f -size +5k -exec rm {} \;

Look at the man pages for find to get more options.

Jonn



--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


Re: [Samba] vfs_recycle folder limit management

2013-09-26 Thread Kevin Field

On 2013-09-26 10:37 AM, Taylor, Jonn wrote:

On 09/26/2013 09:24 AM, Kevin Field wrote:



On 2013-09-26 10:20 AM, Taylor, Jonn wrote:

On 09/26/2013 08:47 AM, Kevin Field wrote:

Hi all,

Running SerNet Samba 4.0.9 on CentOS 6.4 serving as an AD DC and
fileshare for XP clients.

Added recycler per the example at
https://wiki.samba.org/index.php/Frequently_Asked_Questions to my
smb.conf.  Works great.

My concern is that the recycle dir will eventually grow large.
vfs_recycle's docs mention a parameter for limiting individual file
sizes, but what's a best practice to prevent the whole recycle folder
from growing too large?  Cronjob to delete old files when the total is
past a certain size?  Anyone have a script handy?  (I'm hoping I'm not
the only one with this problem :) Seems like it would be a common
concern...)

Thanks,
Kev

I use a script to cleanup the deleted files and run it daily with cron.

cat /usr/bin/cleanupold

#!/bin/bash
find /var/share/.recycle/* -mtime +30 -exec rm {} \;

In /var/spool/cron/root

@daily/usr/bin/cleanupold > /dev/null 2>&1 #Cleanup old audio files


Jonn


Thanks John, but I meant more so is there a way to have it look at the
total size of the recycle dir too?  I.e. only delete stale files when
it needs to to stay within a limit, and also even delete not-so-stale
files if it needs to because there have been too many GB deleted
lately to keep 30 days worth (or whatever) around?

Thanks again,
Kev

This will find files larger than 50MB.

find /var/share/.recycle/* -type f -size +5k -exec rm {} \;

Look at the man pages for find to get more options.

Jonn


Hmm...that's a bit closer, but not exactly.  Maybe I described it better 
on stackexchange...let me copy:



I found tmpwatch, but it's only time-based. What I'd like the system to
do is keep files as long as it reasonably can, i.e., without too much
space being taken up. The flip side is that I also don't want it keeping
files too long if it means running out of space. Thus I'm looking for
something with roughly this thinking:

1. if bin_size < limit then quit
2. delete oldest file in bin
3. goto 1.

Of course there may be a more efficient algorithm, and it could be
tweaked to prefer deleting bigger files unless they're past a certain
age so that a big delete doesn't unnecessarily result in the pruning of
a bunch of older-but-not-too-old small files.
[/quote]

Maybe I'm getting too complicated?

Thanks,
Kev
--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


Re: [Samba] vfs_recycle folder limit management

2013-09-26 Thread Kevin Field



On 2013-09-26 10:20 AM, Taylor, Jonn wrote:

On 09/26/2013 08:47 AM, Kevin Field wrote:

Hi all,

Running SerNet Samba 4.0.9 on CentOS 6.4 serving as an AD DC and
fileshare for XP clients.

Added recycler per the example at
https://wiki.samba.org/index.php/Frequently_Asked_Questions to my
smb.conf.  Works great.

My concern is that the recycle dir will eventually grow large.
vfs_recycle's docs mention a parameter for limiting individual file
sizes, but what's a best practice to prevent the whole recycle folder
from growing too large?  Cronjob to delete old files when the total is
past a certain size?  Anyone have a script handy?  (I'm hoping I'm not
the only one with this problem :) Seems like it would be a common
concern...)

Thanks,
Kev

I use a script to cleanup the deleted files and run it daily with cron.

cat /usr/bin/cleanupold

#!/bin/bash
find /var/share/.recycle/* -mtime +30 -exec rm {} \;

In /var/spool/cron/root

@daily/usr/bin/cleanupold > /dev/null 2>&1 #Cleanup old audio files


Jonn


Thanks John, but I meant more so is there a way to have it look at the 
total size of the recycle dir too?  I.e. only delete stale files when it 
needs to to stay within a limit, and also even delete not-so-stale files 
if it needs to because there have been too many GB deleted lately to 
keep 30 days worth (or whatever) around?


Thanks again,
Kev
--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba