source: trunk/LATMOS-Accounts/bin/la-sql-sanity @ 1044

Last change on this file since 1044 was 1044, checked in by nanardon, 12 years ago

Kill redundant LATMOS::Account::default_base()

Use $LA->base(undef) to get default base instead

  • Property svn:executable set to *
File size: 2.2 KB
Line 
1#!/usr/bin/perl
2
3use strict;
4use warnings;
5use LATMOS::Accounts::Maintenance;
6use LATMOS::Accounts::Log;
7use Getopt::Long;
8use Pod::Usage;
9
10=head1 NAME
11
12    la-expired-reminder - Notify manager about expired account needing deletion
13
14=head1 SYNOPSIS
15
16    la-expired-reminder [options]
17
18=cut
19
20GetOptions(
21    'c|config=s' => \my $config,
22    'b|base=s'   => \my $base,
23    'm|mail'     => \my $mail,
24    'help'       => sub { pod2usage(0) },
25    'users|u=s'  => \my @users,
26    'to=s'       => \my $to,
27    'test'       => \my $test,
28) or pod2usage();
29
30=head1 OPTIONS
31
32=over 4
33
34=item -c|--config configdir
35
36Use this configuration directory instead of the default one.
37
38=item -m|mail
39
40Send a mail to user(s) concerned by the future expiration of his/her/their account(s).
41
42=item u|user USER
43
44Send email only to this user if his/her account will expire. Usefull for
45testing and not sending hundred of mails.
46
47Multiple users can be specified by using -u several times
48
49=item --to MAIL
50
51Instead sending email to user(s) and eventually his/her/their manager(s), send the mail to
52only this email address.
53
54=item --test
55
56With -m, do not send mail but tell to who the mail would have been sent
57
58=back
59
60=head1 CONFIGURATION
61
62Some variables are taken from configuration directory:
63
64=over 4
65
66=item mailFrom
67
68Specify the From address to use in mail
69
70=item smtp
71
72The smtp server to use to send mail
73
74=item alwayscc
75
76In normal mode (without --to), the mail is also sent this email address.
77
78=back
79
80=head1 USERS EMAIL ADDRESSES
81
82The mail use to send warning to users and manager is taken from 'mail'
83attributes. If the attributes is unset, the user will not receive the mail.
84
85=cut
86
87if (!$test) {
88    la_set_log(
89        syslog => [],
90        console => undef,
91    );
92}
93
94my $LA = LATMOS::Accounts->new($config, noacl => 1);
95my $labase = $LA->base($base);
96$labase && $labase->load or die "Cannot load base";
97$labase->wexported(1);
98
99
100foreach (qw(check_user_manager check_group_manager check_nethost_owner)) {
101    my %res = $labase->$_;
102    if (%res) {
103        warn "\n$_:\n";
104        foreach (sort keys %res) {
105            warn "  $_ $res{$_}\n";
106        }
107    }
108}
109# $labase->check_user_manager;
110# $labase->check_group_manager;
111# $labase->check_nethost_owner;
Note: See TracBrowser for help on using the repository browser.