#!/usr/bin/perl use 5.010_000; use strict; use warnings; our $VERSION = '0.01'; =head1 NAME deleteExpiredEntries.pl - Clean the LDAP directory out of expired entries. =head1 SYNOPSIS B [maximum age in seconds] =cut ####################################################################### # use Pod::Usage; use Config::Auto; use lib 'lib'; use Fripost::Schema::Auth; use Fripost::Schema::Pending; use POSIX 'strftime'; # TODO: put that in a config file my $config = { ldap_bind_dn => [ 'cn=DeletePendingEntries','ou=services','o=mailHosting','dc=fripost,dc=dev' ] , ldap_uri => 'ldap://127.0.0.1:389/' , ldap_suffix => [ 'ou=virtual','o=mailHosting','dc=fripost,dc=dev' ] }; my $maxage = $ARGV[0] // 86400; # 24h by default my $fp = Fripost::Schema::Auth::->auth( undef, 'deletependingentries', %$config ) // die; Fripost::Schema::Pending::find ($fp, -quiet => 1, -delete => 1, '-max-age' => $maxage); $fp->done; ####################################################################### # =head1 AUTHOR Guilhem Moulin C<< >> =head1 COPYRIGHT Copyright 2013 Guilhem Moulin. =head1 LICENSE This program is free software; you can redistribute it and/or modify it under the same terms as perl itself. =cut