Per Jessen wrote:
Andrei Borzenkov wrote:
В Wed, 13 Aug 2014 18:00:19 +0200 Per Jessen <per@computer.org> пишет:
I am slowly beginning to migrate a system with multiple postfix instances to 13.1 and therefore also systemd. What is the best way of running multiple instances of postfix with systemd? Basically every "postfix start|stop|reload|whatever" needs a '-c' argument indicating the instance, for example:
postfix -c number4 start
The service.unit is the same, except for the <instance> argument. Can I somehow pass the <instance> as an argument or do I need just create separate service units?
One possibility is to use templates.
postfix@.service as template and then simply
ln -s postfix@.service postfix@<whatever>.service
Inside unit definition you refer to part after @ as %i or %I (should be the same in your case). See man systemd.unit. So start command will become
postfix -c %I start
Thanks Andrei and Cristian - much appreciated!
And it worked really well, brilliant! I created /etc/systemd/system/postfix@.service based on /usr/lib/systemd/system/postfix.service: [Unit] Description=Postfix Mail Transport Agent (%i) 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 After=amavis.service mysql.service cyrus.service ldap.service openslp.service ypbind.service Conflicts=sendmail.service exim.service [Service] Type=forking PIDFile=/var/spool/%i/pid/master.pid ExecStartPre=-/bin/echo 'Starting mail service (%i)' EnvironmentFile=-/etc/sysconfig/postfix ExecStartPre=/etc/postfix/system/config_postfix ExecStartPre=/etc/postfix/system/update_chroot ExecStartPre=/etc/postfix/system/update_postmaps ExecStart=/usr/sbin/postfix -c /etc/%i start ExecStartPost=/etc/postfix/system/wait_qmgr 60 ExecStartPost=/etc/postfix/system/cond_slp register ExecReload=/usr/sbin/postfix -c /etc/%i reload ExecReload=/usr/sbin/postfix -c /etc/%i flush ExecStop=/usr/sbin/postfix -c /etc/%i stop ExecStopPost=/etc/postfix/system/cond_slp deregister [Install] WantedBy=multi-user.target -- Per Jessen, Zürich (17.5°C) http://www.hostsuisse.com/ - dedicated server rental in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org