diff --git a/mail/debian/changelog b/mail/debian/changelog index 1ba49aeda6740cf46d0fbf8728f637d93726b1b6..c543353b0eea6500007d0b615597282363cc7990 100644 --- a/mail/debian/changelog +++ b/mail/debian/changelog @@ -1,3 +1,9 @@ +sympl-mail (11.20210813.0) stable; urgency=medium + + * use systemd socket activation for sympl-mail-poppassd, fixes #315 + + -- Tim Stallard Fri, 13 Aug 2021 14:24:33 +0100 + sympl-mail (11.20210408.0) stable; urgency=medium * Spam tagging now works as expected, prefixing the subject of accepted diff --git a/mail/debian/rules b/mail/debian/rules index 7daa3a0b15e5dc6b9a1cca2f0e79edae3e1e6235..fdfb7b6286576ea5cd103b727e124ec4e5fe21cd 100755 --- a/mail/debian/rules +++ b/mail/debian/rules @@ -24,7 +24,7 @@ override_dh_auto_clean: override_dh_systemd_enable: dh_systemd_enable -psympl-mail --name sympl-mail-dict-proxy sympl-mail-dict-proxy.service - dh_systemd_enable -psympl-mail --name sympl-mail-poppassd sympl-mail-poppassd.service + dh_systemd_enable -psympl-mail --name sympl-mail-poppassd sympl-mail-poppassd.socket override_dh_installinit: dh_installinit -R --name sympl-mail-dict-proxy diff --git a/mail/debian/sympl-mail.sympl-mail-poppassd.service b/mail/debian/sympl-mail.sympl-mail-poppassd.service index 6c21287045bcf487b1789c648efa1b99b7ed6aeb..c6320b8689f6e9515705fafcb9750b5c6c1d11cf 100644 --- a/mail/debian/sympl-mail.sympl-mail-poppassd.service +++ b/mail/debian/sympl-mail.sympl-mail-poppassd.service @@ -5,6 +5,3 @@ Description=Sympl: mail poppass daemon Type=simple ExecStart=/usr/sbin/sympl-mail-poppassd Restart=always - -[Install] -WantedBy=multi-user.target diff --git a/mail/debian/sympl-mail.sympl-mail-poppassd.socket b/mail/debian/sympl-mail.sympl-mail-poppassd.socket new file mode 100644 index 0000000000000000000000000000000000000000..b73ef9a247be9b98fb87ad90ba7a23e7a0eaa532 --- /dev/null +++ b/mail/debian/sympl-mail.sympl-mail-poppassd.socket @@ -0,0 +1,8 @@ +[Unit] +Description=Sympl: mail poppass listener + +[Socket] +ListenStream=127.0.0.1:106 + +[Install] +WantedBy=sockets.target diff --git a/mail/sbin/sympl-mail-poppassd b/mail/sbin/sympl-mail-poppassd index b6ce93353f079ca761fd49622fc84591b14f1647..848223e4dd917ef09bf2311a4fbb8df927ee4a49 100755 --- a/mail/sbin/sympl-mail-poppassd +++ b/mail/sbin/sympl-mail-poppassd @@ -84,23 +84,18 @@ syslog = Syslog.open( File.basename($0), Syslog::LOG_NDELAY && Syslog::LOG_PERRO Symbiosis::Email::PoppassHandler.prefix = prefix Symbiosis::Email::PoppassHandler.syslog = syslog -# If we use systemd socket activation in future, here's how. -# -# SD_LISTEN_FDS_START = 3 -# -# if ENV['LISTEN_PID'].to_i == $$ -# # use existing socket passed from systemd -# systemd_socket = Socket.for_fd(SD_LISTEN_FDS_START + 0) -# syslog.info "Got socket #{SD_LISTEN_FDS_START + 0} from systemd" -# end - EventMachine.run do begin - EventMachine.start_server "127.0.0.1", port, Symbiosis::Email::PoppassHandler + SD_LISTEN_FDS_START = 3 + if ENV['LISTEN_PID'].to_i == $$ + #use existing socket passed from systemd + systemd_socket = Socket.for_fd(SD_LISTEN_FDS_START + 0) + EventMachine.attach_server(systemd_socket, Symbiosis::Email::PoppassHandler) + else + EventMachine.start_server "127.0.0.1", port, Symbiosis::Email::PoppassHandler + end rescue StandardError => err syslog.info "Caught #{err.to_s} " EM.stop end end - -