Siebel-Lbconfig

 view release on metacpan or  search on metacpan

lib/Siebel/Lbconfig.pm  view on Meta::CPAN

        $aliases{ $row->{comp_alias} } = $row->{vs};
    }

    close($out);

    my $pattern    = File::Spec->catfile( $dir, 'eapps*.cfg' );
    my @eapps      = glob($pattern);
    my $conn_regex = qr#^ConnectString#;
    my $replace_regex =
      qr#^(ConnectString\s?\=\s?siebel\.TCPIP\.\w+\.\w+\://)\w+(/\w+/)(\w+)#;
    foreach my $file (@eapps) {
        my $new = "$file.new";
        open( my $old, '<', $file ) or confess "Cannot read $file: $!";
        open( my $out, '>', $new )  or confess "Cannot create $new: $!";

        while (<$old>) {

    #ConnectString = siebel.TCPIP.None.None://VirtualServer/foobar/ERMObjMgr_chs
            if ( $_ =~ $conn_regex ) {
                chomp();

                if ( $_ =~ $replace_regex ) {

                    if ( exists( $aliases{$3} ) ) {
                        print $out $1, $aliases{$3}, $2, $3, "\n";
                    }
                    else {
                        print $out $_, "\n";
                    }

                }
                else {
                    print $out $_, "\n";
                }

            }
            else {
                print $out $_;
            }

        }

        close($old);
        close($out);

    }
}

=head1 CONFIGURATION FILE

The configuration file must have a INI format, which is supported by the L<Config::Tiny> module.

Here is an example of the required parameters:

    [GENERAL]
    gateway=foobar:1055
    enterprise=MyEnterprise
    user=sadmin
    password=123456
    srvrmgr= /foobar/bin/srvrmgr
    load_prefs = 1
    type = light
    time_zone = America/Sao_Paulo

Beware that the commands executed by C<lbconfig> requires that the output has a specific configuration set: setting
C<load_prefs> is not optional here, but a requirement!

Also make sure to use C<type = light> because this distribution really doesn't need L<Siebel::Srvrmgr::Daemon::Heavy> and is
intended to work on MS Windows too.

=head1 SEE ALSO

=over

=item *

L<Siebel::Srvrmgr>

=item *

L<Config::Tiny>

=item *

L<Siebel::Srvrmgr::Util::IniDaemon>

=back

=head1 AUTHOR

Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2016 of Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>

This file is part of Siebel Monitoring Tools.

Siebel Monitoring Tools is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Siebel Monitoring Tools is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Siebel Monitoring Tools.  If not, see <http://www.gnu.org/licenses/>.

=cut

1;



( run in 1.166 second using v1.01-cache-2.11-cpan-302cb4679cc )