]> Frank Brehm's Git Trees - my-stuff/py-logrotate.git/commitdiff
Mit Behandlung von PID-Dateien angefangen.
authorFrank Brehm <frank@brehm-online.com>
Fri, 20 May 2011 21:07:12 +0000 (21:07 +0000)
committerFrank Brehm <frank@brehm-online.com>
Fri, 20 May 2011 21:07:12 +0000 (21:07 +0000)
git-svn-id: http://svn.brehm-online.com/svn/my-stuff/python/PyLogrotate/trunk@244 ec8d2aa5-1599-4edb-8739-2b3a1bc399aa

LogRotateConfig.py
LogRotateHandler.py
logrotate.py
po/LogRotateConfig.de.po
po/LogRotateConfig.pot
test/apache2

index b2ee1585c4e20d26ab313979a2a5b774d6d143e0..bd61a0641f55b33ab32b45939d3d8cc0bfb1e2f4 100755 (executable)
@@ -208,6 +208,12 @@ class LogrotateConfigurationReader(object):
         @type: logging.getLogger
         '''
 
+        self.global_option = {}
+        '''
+        @ivar: all global options
+        @type: dict
+        '''
+
         if not logger:
 
             #################################################
@@ -1074,10 +1080,10 @@ class LogrotateConfigurationReader(object):
                     return False
             if self.verbose > 4:
                 self.logger.debug(
-                    ( _("Setting '%(option)s' in '%(directive)s' to '%(value)s'. (file '%(file)s', line %(lnr)s)")
+                    ( _("Setting global option '%(option)s' to '%(value)s'. (file '%(file)s', line %(lnr)s)")
                         % {'option': key, 'directive': directive_str, 'value': str(val), 'file': filename, 'lnr': linenr})
                 )
-            directive[key] = val
+            self.global_option[key] = val
             return True
 
         # Check for rotation period
index 053899d2e0545fe0044baacbd2caad6f3d3a278f..bb70ad18f1efc7285c99d54ab17da8e234a2aed0 100755 (executable)
@@ -20,6 +20,8 @@ import sys
 import gettext
 import logging
 import pprint
+import os
+import os.path
 
 from LogRotateConfig import LogrotateConfigurationError
 from LogRotateConfig import LogrotateConfigurationReader
@@ -252,8 +254,25 @@ class LogrotateHandler(object):
             self.logger.error( str(e) )
             sys.exit(10)
 
+        if self.state_file is None:
+            if 'statusfile' in config_reader.global_option and \
+                    config_reader.global_option['statusfile'] is not None:
+                self.state_file = config_reader.global_option['statusfile']
+            else:
+                self.state_file = os.sep + os.path.join('var', 'lib', 'py-logrotate.status')
+
+        if self.pid_file is None:
+            if 'pidfile' in config_reader.global_option and \
+                    config_reader.global_option['pidfile'] is not None:
+                self.pid_file = config_reader.global_option['pidfile']
+            else:
+                self.pid_file = os.sep + os.path.join('var', 'run', 'py-logrotate.pid')
+
         return True
 
+    #------------------------------------------------------------
+
+
 #========================================================================
 
 if __name__ == "__main__":
index ab6c338877f6879991396375f449de3b5fddf4ba..71c3f29c6db36d22f402d5e967249500d2733342 100755 (executable)
@@ -84,6 +84,7 @@ def main():
         verbose    = verbose_level,
         force      = opt_parser.options.force,
         state_file = opt_parser.options.statefile,
+        pid_file   = opt_parser.options.pidfile,
         mail_cmd   = opt_parser.options.mailcmd,
         local_dir  = local_dir,
     )
index 68d4bb8bf1ffc5bc2ce36e932da8868b7458cfe3..5efa8b8ac8787771ef21be9448a88cc9bfde2658 100644 (file)
@@ -298,6 +298,12 @@ msgstr "Die Option »%s« ist innerhalb einer Logdateidefinition nicht erlaubt."
 msgid "Value '%(value)s' for option '%(option)s' is not an absolute path."
 msgstr "Der Wert »%(value)s« für die Option »%(option)s« ist keine absolute Pfadangabe."
 
+#: LogRotateConfig.py:1083
+msgid "Setting global option '%(option)s' to '%(value)s'. (file '%(file)s', line %(lnr)s)"
+msgstr ""
+"Setze globale Option »%(option)s auf »%(value)s«. "
+"(Datei »%(file)s«, Zeile %(lnr)s)"
+
 #: LogRotateConfig.py:1077
 #, python-format
 msgid ""
index ee5d362f3758a34c85b65a0d2d7aa73b789dfa09..fd5fe46f896af5b21571859df9bb4b7c7123e784 100644 (file)
@@ -264,6 +264,11 @@ msgstr ""
 msgid "Value '%(value)s' for option '%(option)s' is not an absolute path."
 msgstr ""
 
+#: LogRotateConfig.py:1083
+#, python-format
+msgid "Setting global option '%(option)s' to '%(value)s'. (file '%(file)s', line %(lnr)s)"
+msgstr ""
+
 #: LogRotateConfig.py:1077
 #, python-format
 msgid "Setting '%(option)s' in '%(directive)s' to '%(value)s'. (file '%(file)s', line %(lnr)s)"
index c559729d9a46237fd358788bec5beb2ab046de32..a874b3d7f69b43310bc8ea62646c636f47548355 100644 (file)
@@ -2,6 +2,7 @@
 # Contributes by Chuck Short
 #
 
+
 /var/log/apache2/access_log
 /var/log/apache2/*.log
 {