gunnar: server/kolabconf/bin kolabconf.in,NONE,1.1

cvs at kolab.org cvs at kolab.org
Wed Aug 1 12:38:34 CEST 2007


Author: gunnar

Update of /kolabrepository/server/kolabconf/bin
In directory doto:/tmp/cvs-serv10307/bin

Added Files:
	kolabconf.in 
Log Message:
A draft version for a seperate kolabconf package.

--- NEW FILE: kolabconf.in ---
#!perl

##  COPYRIGHT
##  ---------
##
##  See AUTHORS file
##
##
##  LICENSE
##  -------
##
##  This program 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 2 of the License, or
##  (at your option) any later version.
##
##  This program 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 this program; if not, write to the Free Software
##  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
##
##  $Revision: 1.1 $

use 5.008;
use strict;
use warnings;

our $VERSION = '1.0';

use Getopt::Std;
use Sys::Syslog;
use IO::File;
use Kolab;

Kolab::reloadConfig("@CONFIG_FILE@");

use Kolab::Util;
use Kolab::Conf;
use Kolab::LDAP;
use vars qw($opt_d $opt_n $opt_h);

openlog('kolabconf', 'cons, pid', 'user');

getopts('dnh');
if ($opt_h) {
    print <<'EOS';
Usage: kolabconf [-d] [-n] [-h]

    Option d (debug) to print out the current config.
    Option n (noreload) to skip reloading services after changing configuration.
    Option h (help) to get this text.
EOS
    exit 0;
}

if ($opt_d) {
    foreach my $key (sort keys %Kolab::config) {
	my $value;
	if( ref($Kolab::config{$key}) eq "ARRAY" ) {
	    $value = join( ", ", @{$Kolab::config{$key}});
	} else {
	    $value = $Kolab::config{$key};
	}
        print "$key : " . $value . "\n";
    }
    exit 0;
}

my $do_reload = 1;
if($opt_n) {
    $do_reload = 0;
}

if( !$Kolab::reloadOk ) {
    my $msg = "Error loading configuration. Maybe the LDAP server is not running. Please check the system log for errors.";
    print STDERR "$msg\n";
    Kolab::log('KC', $msg);
    exit(-1);
}

Kolab::log('KC', 'Rebuilding templates');
Kolab::Conf::rebuildTemplates;
Kolab::log('KC', 'Reloading kolab components');

if( $do_reload ) {
    Kolab::Conf::reload;
}

Kolab::log('KC', 'Finished');





More information about the commits mailing list