I want to migrate to opensuse 13.1 and I just can’t find out how to configure the systemd scripts to start a dual sendmail daemon. Everything gets sent to systemctl and I’m just not familiar with it…
I need sendmail to start twice: one daemon listening on port 25 and one on port 10025. I use amavis in between listening on port 10024. So: the first sendmail (port 25) receives the mail -from fetchmail-, delivers it to amavis (port 10024) which delivers it to the second sendmail (port 10025), which sends the mails to the mailbox.
I need to start two sendmail daemons, as simple as that…
You will need to either create to different units with different name or create template unit that can be used to start different services from the same definition (like “systemctl start sendmail@25.service” and “systemctl start sendmail@10025.service”). See “man systemd.unit” for description of templates and there is plenty of examples in distributed units.
… and that is my problem… maybe I am too stupid but, as I said, I am not familiar at all with systemd/systemctl, so it’s not easy for me to get it right…
I would be really thankful if someone could post some examples that I could -so to say- copy and paste. One daemon is running as a standard so I guess I should only add one instance, but how?
I am not sure whether I do need two daemons… I actually did it that way because the first one (port 25) doesn’t do delivery, it just receives the mails and gives them to amavis (spam and virus checker), which gives them to the second daemon which then does the delivery…
Is this something you are doing as well?
I have not done that with systemd. I’d start by reading the man page recommended above by arvidjaar. If you need further help, hopefully someone with experience creating service definitions will be able to assist.
opensuse forums
systemd/systemctl dual sendmail
Although I haven’t done what you describe, in theory it’s pretty simple to do what you require.
Install sendmail (or postfix which is actually the default SMTP server in openSUSE). It’ll install everything necessary to run in a default state.
run something like the following
systemctl status sendmail.service
In the text you’ll find the path to the Unit file which in systemd is the master config file(likely at /usr/lib/systemd/system/). In some ways it’s similar to an init.d script except for a number of improvements… First invocation creates a CGROUP so all other instances like you’re trying to do will be managed together.and usually share resources instead of creating a whole new process. Also, a Unit file is almost always a “master config” file so it points to other config files (often standard files found in init.d systems).
Although it might be possible to add a new instance configuration to the existing Sendmail service, I suspect it might be easier to keep the new instance configuration completely separate.
3. When you find the original created Unit file, copy it to
/etc/systemd/system/system/
Now, if you wanted to modify the <existing installed> systemd function, you should just modify the file in the new location, it would over-ride the original installed file.
But,
Although it might be possible to add a new instance configuration to the existing Sendmail service, I suspect it might be easier to keep the new instance configuration completely separate.
To keep your copy’s configuration from completely over-writing the original default configuration, giving it a new name so it shouldn’t over-write the original Unit settings and create something new.
You may have to play around with the modifications in the Unit file(careful not to modify original configs which are still used by the original Unit file). Note though by working with a copy of the original you’re in no danger of damaging the original install… just delete the copy you’re working on.
thank you everybody, I seem to have managed to make it work!
I created the two service files (ports 25 and 10025) with the proper variables, renamed the original one, and voila, it works…
Now, I had a working dual sendmail + amavis setup and just upgraded the OS. I am not going to explain that setup, I am just describing how I made it to start the two needed sendmail daemons under systemd/systemctl.
# This file is part of package sendmail.
#
# Copyright (c) 2011 SuSE LINUX Products GmbH, Germany.
# Author: Werner Fink
# Please send feedback to http://www.suse.de/feedback
#
# Description:
#
# Used to start the sendmail Mail Transport Agent service
# which handles all mails stored at /var/spool/mqueue/ and
# all connections on port 25 aka smtp at localhost as well
# as on all other network interfaces.
#
[Unit]
Description=Sendmail Mail Transport Agent
Requires=var-run.mount nss-lookup.target network.target remote-fs.target time-sync.target
After=var-run.mount nss-lookup.target network.target remote-fs.target time-sync.target
Wants=amavis.service cyrus.service ldap.service nscd.service ypbind.service sendmail-client.service
After=amavis.service cyrus.service ldap.service nscd.service ypbind.service
Before=sendmail-client.service mail-transfer-agent.target
Conflicts=postfix.service exim.service
[Service]
Type=forking
PIDFile=/var/run/sendmail-rx.pid
ExecStartPre=-/bin/echo 'Initializing SMTP port 25 (sendmail-rx)'
ExecStartPre=-/etc/mail/system/sm.pre
Environment="SENDMAIL_ARGS=-C/etc/sendmail-rx.cf -L sendmail-rx -Am -bd -qp -om"
Environment=SENDMAIL_PORT_OPTS=
EnvironmentFile=-/etc/sysconfig/mail
EnvironmentFile=-/etc/sysconfig/sendmail
EnvironmentFile=-/var/run/sendmail/port
ExecStart=/usr/sbin/sendmail $SENDMAIL_PORT_OPTS $SENDMAIL_ARGS
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target