Purge based on atime, not mtime (as the touch option in the recycle vfs only change atime, not mtime)

tags/ipasserelle-base-0.2.65-1 0.2.32
Daniel Berteaud 11 years ago
parent 2a9010d193
commit 559c374f3f
  1. 4
      root/etc/cron.daily/purge-homes-recycle

@ -45,8 +45,8 @@ foreach my $user ($a->get_all_by_prop(type=>'user')){
sub remove{ sub remove{
# Remove files with last modification older than $retention # Remove files with last modification older than $retention
if ( -f ){ if ( -f ){
my $mtime = stat($_)->mtime; my $atime = stat($_)->atime;
(time() - $mtime > $retention) && unlink($_); (time() - $atime > $retention) && unlink($_);
} }
# Remove empty directories # Remove empty directories
elsif ( -d ){ elsif ( -d ){

Loading…
Cancel
Save