KFreeBSD uses a different syslog socket just because
[mirror/userdir-ldap.git] / ud-replicated
old mode 100644 (file)
new mode 100755 (executable)
index ac83a4d..26f8695
@@ -63,7 +63,10 @@ FORMAT='%(asctime)s ud-replicated: %(levelname)s %(message)s'
 SFORMAT='ud-replicated[%(process)s]: %(message)s'
 logging.basicConfig(format=FORMAT, level=lvl)
 LOG = logging.getLogger(__name__)
-syslog_handler = logging.handlers.SysLogHandler(address = '/dev/log')
+logsock = '/dev/log'
+if os.path.exists('/var/run/log'): # Kfreebsd randomly different
+    logsock = '/var/run/log'
+syslog_handler = logging.handlers.SysLogHandler(address = logsock)
 formatter = logging.Formatter(SFORMAT)
 syslog_handler.setFormatter(formatter)
 LOG.addHandler(syslog_handler)
@@ -84,7 +87,7 @@ def do_replicate(message):
             LOG.error('%s failed:', ' '.join(command))
         else:
             LOG.debug('%s finished with ret: 0' % ' '.join(command))
-       finally:
+        finally:
             os.environ['TERM'] = old_term
     LOG.debug(message)