stuart: devel/kolab kolabconf,1.3,1.4 kolabd,1.1.1.1,1.2

cvs at intevation.de cvs at intevation.de
Wed May 12 15:12:36 CEST 2004


Author: stuart

Update of /kolabrepository/devel/kolab
In directory doto:/tmp/cvs-serv24022

Modified Files:
	kolabconf kolabd 
Log Message:
Added pointer to COPYING for licensing details
Changed $config{'prefix'} to $config{'kolab_root'}
Updated daemon for the new template stuff


Index: kolabconf
===================================================================
RCS file: /kolabrepository/devel/kolab/kolabconf,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- kolabconf	12 May 2004 11:05:01 -0000	1.3
+++ kolabconf	12 May 2004 13:12:34 -0000	1.4
@@ -52,7 +52,7 @@
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE,
-to the extent permitted by law.
+to the extent permitted by law. See the file COPYING for license details.
 ";
 }
 

Index: kolabd
===================================================================
RCS file: /kolabrepository/devel/kolab/kolabd,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- kolabd	3 May 2004 14:04:04 -0000	1.1.1.1
+++ kolabd	12 May 2004 13:12:34 -0000	1.2
@@ -1,92 +1,122 @@
 #!/kolab/bin/perl
 
-##
-##  Copyright (c) 2003  Code Fusion cc
-##
-##    Writen by Stuart Bingë  <s.binge at codefusion.co.za>
-##    Portions based on work by the following people:
-##
-##      (c) 2003  Tassilo Erlewein  <tassilo.erlewein at erfrakon.de>
-##      (c) 2003  Martin Konold     <martin.konold at erfrakon.de>
-##      (c) 2003  Achim Frank       <achim.frank at erfrakon.de>
-##
-##
-##  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, 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 can view the  GNU General Public License, online, at the GNU
-##  Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
-##
-
-#
-#  Module prefixes in the logs:
-#    K: kolabd
-#    C: Config
-#    T: Templates
-#    L: LDAP
-#    Y: Cyrus
-#    B: Backend
-#    KC: kolabconf
-#    DS: DirServ
-#    Anything else: the various backends
-#
+##########################################################################
+##                                                                      ##
+##  The Kolab Groupware Server                                          ##
+##                                                                      ##
+##    See the file CONTRIBUTORS that was distributed with this program  ##
+##  for copyright information.                                          ##
+##                                                                      ##
+##    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 can view the GNU  General Public License, online, at the GNU  ##
+##  project's  web  site;  see <http://www.gnu.org/licenses/gpl.html>.  ##
+##  The full text of the license is also included in the file COPYING.  ##
+##                                                                      ##
+##########################################################################
 
 use strict;
-use Sys::Syslog;
+use Getopt::Long;
 use IO::File;
 use Kolab;
 use Kolab::Util;
 use Kolab::DirServ;
 use Kolab::LDAP;
 use Kolab::LDAP::Backend;
-use vars qw(%pids);
 
-openlog('kolabd', 'cons, pid', 'user');
+our $VERSION = sprintf("%d.%02d", q$Revision$ =~ /(\d+)\.(\d+)/);
 
-my $prefix = $Kolab::config{'prefix'};
-my $pidfile = IO::File->new("$prefix/var/kolab/kolab.pid", 'w+')
-    || die "Unable to open PID file `$prefix/var/kolab/kolab.pid'";
-print $pidfile $$;
-undef $pidfile;
+sub PREFIX() { return "kolabd"; }
+
+our (@configs, $help, $version);
+GetOptions (
+    "config=s"      => \@configs,
+    "help"          => \$help,
+    "version"       => \$version
+);
+
+our %childPIDs;
+
+sub printVersion()
+{
+    print "kolabd version $VERSION
+See the file CONTRIBUTORS that was distributed with this program for
+copyright information.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE,
+to the extent permitted by law. See the file COPYING for license details.
+";
+}
+
+sub printHelp()
+{
+    print "Usage: $0 [OPTION]...
+
+  -c[cfgfile], --config[=cfgfile]
+                 load configuration data from file cfgfile
+      --help     display this help and exit
+      --version  output version information and exit
+";
+}
+
+if ($version) {
+    printVersion();
+    exit(0);
+} elsif ($help) {
+    printHelp();
+    exit(0);
+}
+
+Kolab::loadConfig(@configs);
+Kolab::initLog;
+
+sub writePID
+{
+    my $pidfile = IO::File->new("$Kolab::config{'kolab_var'}/kolab.pid", 'w+')
+        || die "Unable to open file $Kolab::config{'kolab_var'}/kolab.pid for writing";
+    print $pidfile $$;
+}
 
 sub sigInt
 {
-    Kolab::superLog('Kolab is shutting down');
+    Kolab::log(PREFIX, 'SIGINT/SIGTERM detected, kill()ing children');
 
-    Kolab::log('K', 'SIGINT/SIGTERM detected, kill()ing children');
+    Kolab::log(PREFIX, 'Kolab is shutting down', KOLAB_SUPER);
 
-    foreach my $pid (keys %pids) {
+    foreach my $pid (keys %childPIDs) {
         kill('INT', $pid);
         waitpid($pid, 0);
     }
 
     Kolab::LDAP::shutdown;
 
-    Kolab::log('K', 'Exiting');
+    Kolab::log(PREFIX, 'Exiting');
     exit(0);
 }
 
 sub sigHup
 {
-    Kolab::log('K', 'Refreshing configuration');
-    foreach my $pid (keys %pids) {
+    Kolab::log(PREFIX, 'Refreshing configuration');
+    foreach my $pid (keys %childPIDs) {
         kill('INT', $pid);
         waitpid($pid, 0);
     }
     %pids = ();
-    Kolab::reloadConfig;
-    Kolab::log('K', 'Synchronising');
+    Kolab::loadConfig(@configs);
+    Kolab::log(PREFIX, 'Synchronising');
     Kolab::LDAP::sync;
-    Kolab::log('K', 'Reloading addressbook.peers');
+    Kolab::log(PREFIX, 'Reloading addressbook.peers');
     Kolab::DirServ::reloadPeers;
-    Kolab::log('K', 'Finished refresh');
+    Kolab::log(PREFIX, 'Finished refresh');
     &run;
 }
 
@@ -95,10 +125,10 @@
     my $pid;
     my $finished = 0;
     foreach my $backend (keys %Kolab::LDAP::Backend::backends) {
-        Kolab::log('K', "Forking `$backend' listener");
+        Kolab::log(PREFIX, "Forking '$backend' listener");
         $pid = fork;
         if (!defined($pid)) {
-            Kolab::log('K', "Unable to fork `$backend' listener", KOLAB_ERROR);
+            Kolab::log(PREFIX, "Unable to fork '$backend' listener", KOLAB_ERROR);
             exit(1);
         }
 
@@ -115,43 +145,34 @@
     $SIG{'TERM'} = \&sigInt;
     $SIG{'HUP'} = \&sigHup;
 
-    Kolab::log('K', 'Listeners spawned, wait()ing');
+    Kolab::log(PREFIX, 'Listeners spawned, wait()ing');
 
     while ($finished > 0) {
         wait;
         if ($?) {
-            Kolab::log('K', 'Abnormal child exit status encountered, aborting');
+            Kolab::log(PREFIX, 'Abnormal child exit status encountered, aborting');
             kill('INT', $$);
         } else {
-            Kolab::log('K', 'Child terminated normally');
+            Kolab::log(PREFIX, 'Child terminated normally');
         }
     }
 }
 
-print 'kolabd - Kolab Backend Daemon
-
-  Copyright (c) 2003  Code Fusion cc
-  Copyright (c) 2003  Tassilo Erlewein, Martin Konold, Achim Frank
-
-This is free software; see the source for copying conditions.  There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-';
-
-Kolab::superLog('Kolab is starting up');
+Kolab::log(PREFIX, 'Kolab is starting up', KOLAB_SUPER);
 
 Kolab::LDAP::startup;
 
-Kolab::log('K', 'Loading backends');
+Kolab::log(PREFIX, 'Loading backends');
 Kolab::LDAP::Backend::load;
 Kolab::LDAP::Backend::load('user');
 Kolab::LDAP::Backend::load('sf');
 Kolab::LDAP::Backend::load('dirservd',1);
 
-Kolab::log('K', 'Performing backend startup');
+Kolab::log(PREFIX, 'Performing backend startup');
 &Kolab::LDAP::Backend::startup;
 
-Kolab::log('K', 'Synchronising');
+Kolab::log(PREFIX, 'Synchronising');
 Kolab::LDAP::sync;
 
-Kolab::log('K', 'Synchronisation complete, starting up daemon');
+Kolab::log(PREFIX, 'Synchronisation complete, starting up daemon');
 run;





More information about the commits mailing list