source: XIOS/tools/FCM/examples/sbin/fcm-vacuum-trac-env-db @ 1293

Last change on this file since 1293 was 81, checked in by ymipsl, 12 years ago

ajout FCM 1.5

File size: 1.8 KB
Line 
1#!/usr/bin/perl
2# ------------------------------------------------------------------------------
3# (C) Crown copyright Met Office. All rights reserved.
4# For further details please refer to the file COPYRIGHT.txt
5# which you should have received as part of this distribution.
6# ------------------------------------------------------------------------------
7
8use strict;
9use warnings;
10
11use FindBin;
12use lib "$FindBin::Bin/../lib";
13use FCM::Admin::System qw{
14    filter_projects
15    get_projects_from_trac_live
16    vacuum_trac_env_db
17};
18use FCM::Admin::Util qw{option2config};
19use Getopt::Long qw{GetOptions};
20use Pod::Usage qw{pod2usage};
21
22main();
23
24sub main {
25    my %option;
26    my $result = GetOptions(
27        \%option,
28        q{help|usage|h},
29        q{trac-live-dir=s},
30    );
31    if (!$result) {
32        pod2usage(1);
33    }
34    if (exists($option{help})) {
35        pod2usage(q{-verbose} => 1);
36    }
37    option2config(\%option);
38    my @projects = filter_projects([get_projects_from_trac_live()], \@ARGV);
39    for my $project (@projects) {
40        vacuum_trac_env_db($project);
41    }
42}
43
44__END__
45=head1 NAME
46
47fcm-vacuum-trac-env-db
48
49=head1 SYNOPSIS
50
51    fcm-vacuum-trac-env-db [OPTIONS] [PROJECT ...]
52
53=head1 OPTIONS
54
55=over 4
56
57=item --help, -h, --usage
58
59Prints help and exits.
60
61=item --trac-live-dir=DIR
62
63Specifies the root location of the live directory of Trac environments. See
64L<FCM::Admin::Config|FCM::Admin::Config> for the current default.
65
66=back
67
68=head1 ARGUMENTS
69
70=over 4
71
72=item PROJECT
73
74Specifies one or more project to vacuum. If no project is specified, the
75program searches the live directory for projects to vacuum.
76
77=back
78
79=head1 DESCRIPTION
80
81This program issues the "VACUUM" SQL command in the databases of the Trac
82environments in the live directory.
83
84=head1 COPYRIGHT
85
86E<169> Crown copyright Met Office. All rights reserved.
87
88=cut
Note: See TracBrowser for help on using the repository browser.