Enable sd_listen_fds(3)-style socket-activation support
I've added straightforward systemd unit files in system/socket-activation/ that make use of this approach, and a README.md in the same location that describes the tradeoffs.
This commit is contained in:
@@ -355,7 +355,16 @@ def main():
|
||||
miltername = 'dkimpy-filter'
|
||||
socketname = milterconfig.get('Socket')
|
||||
if socketname is None:
|
||||
socketname = 'local:/var/run/dkimpy-milter/dkimpy-milter.sock'
|
||||
if int(os.environ.get('LISTEN_PID', '0')) == os.getpid():
|
||||
lfds = os.environ.get('LISTEN_FDS')
|
||||
if lfds is not None:
|
||||
if lfds != '1':
|
||||
syslog.syslog('LISTEN_FDS is set to "{0}", but we only know how to deal with "1", ignoring it'.
|
||||
format(lfds))
|
||||
else:
|
||||
socketname = 'fd:3'
|
||||
if socketname is None:
|
||||
socketname = 'local:/var/run/dkimpy-milter/dkimpy-milter.sock'
|
||||
own_socketfile(milterconfig, socketname)
|
||||
drop_privileges(milterconfig)
|
||||
sys.stdout.flush()
|
||||
|
||||
Reference in New Issue
Block a user