New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
fcm-recover-trac-env in vendors/fcm/current/examples/sbin – NEMO

source: vendors/fcm/current/examples/sbin/fcm-recover-trac-env @ 1977

Last change on this file since 1977 was 1977, checked in by flavoni, 14 years ago

importing fcm vendor

File size: 3.1 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_backup
16    recover_trac_environment
17    recover_trac_ini_file
18    recover_trac_passwd_file
19};
20use FCM::Admin::Util qw{option2config};
21use Getopt::Long qw{GetOptions};
22use Pod::Usage qw{pod2usage};
23
24main();
25
26sub main {
27    my %option;
28    my $result = GetOptions(
29        \%option,
30        q{help|usage|h},
31        q{no-ini-file},
32        q{no-passwd-file},
33        q{trac-backup-dir=s},
34        q{trac-live-dir=s},
35        q{trac-ini-file=s},
36        q{trac-passwd-file=s},
37    );
38    if (!$result) {
39        pod2usage(1);
40    }
41    if (exists($option{help})) {
42        pod2usage(q{-verbose} => 1);
43    }
44    option2config(\%option);
45    my @projects = filter_projects([get_projects_from_trac_backup()], \@ARGV);
46    for my $project (@projects) {
47        recover_trac_environment($project);
48    }
49    if (!@ARGV && !exists($option{q{no-ini-file}})) {
50        recover_trac_ini_file();
51    }
52    if (!@ARGV && !exists($option{q{no-passwd-file}})) {
53        recover_trac_passwd_file();
54    }
55}
56
57__END__
58
59=head1 NAME
60
61fcm-recover-trac-env
62
63=head1 SYNOPSIS
64
65    fcm-recover-trac-env [OPTIONS] [PROJECT ...]
66
67=head1 OPTIONS
68
69=over 4
70
71=item --help, -h, --usage
72
73Prints help and exits.
74
75=item --no-ini-file
76
77Do not recover the (central) INI file. This option is automatic if one or more
78project name is specified in the argument list.
79
80=item --no-passwd-file
81
82Do not recover the password file. This option is automatic if one or more
83project name is specified in the argument list.
84
85=item --trac-backup-dir=DIR
86
87Specifies the root location of the backup directory. See
88L<FCM::Admin::Config|FCM::Admin::Config> for the current default.
89
90=item --trac-ini-file=FILE
91
92Specifies the base name of the Trac INI file. See
93L<FCM::Admin::Config|FCM::Admin::Config> for the current default.
94
95=item --trac-live-dir=DIR
96
97Specifies the root location of the live directory. See
98L<FCM::Admin::Config|FCM::Admin::Config> for the current default.
99
100=item --trac-passwd-file=FILE
101
102Specifies the base name of the Trac password file. See
103L<FCM::Admin::Config|FCM::Admin::Config> for the current default.
104
105=back
106
107=head1 ARGUMENTS
108
109=over 4
110
111=item PROJECT
112
113Specifies one or more project to recover. If no project is specified, the
114program searches the backup directory for projects to recover.
115
116No attempt to recover the (central) INI file and the password file is made if
117one or more project name is specified.
118
119=back
120
121=head1 DESCRIPTION
122
123This program recovers Trac environments, the (central) INI file and the
124password file from the backup directory to the live directory.
125
126=head1 COPYRIGHT
127
128E<169> Crown copyright Met Office. All rights reserved.
129
130=cut
Note: See TracBrowser for help on using the repository browser.