1

I am running Ubuntu 16.04.3.

I have configured that a docker container sends email using the host's smtp (postfix). In order for this to work, I have to add the docker network to postfix's main.cf file. Problem is that postfix starts before docker and throws an error about the network not being there, which is true because docker.service did not start yet, and therefore ignores it.

If postfix had a native systemd service unit file, I would just make it require docker.service, but postfix has SysV script, which systemd translates into service unit during boot.

Question is, how can I make postfix depend on docker being started? Or to put it more generically, how can i make a service which does not have a native systemd service unit file depend on a service that does have one.

I did see the couple of "keywords" I can use in the SysV script:

### BEGIN INIT INFO
# Provides: my-service
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Default-Start:  2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop service my-service
# Description: my-service blah blah ...
### END INIT INFO

and there is an $all keyboard, which according to documentation, should mark this service as being started after everything else, but is this "everything else" all the systemd services or services that only have sysV scripts?

UPDATE

Setting $all to Required-Start for postfix SysV did not fix my issue.

  • 2
    it is probably easier to port the sysv script into to systemd and then use the dependency features of systemd directly rather than trying to bolt them back onto sysv init... – thrig Jan 23 '18 at 16:36
  • possibly, but not sure what next postfix update will do – ColdAir Jan 23 '18 at 16:38
  • It is probably even easier not to use systemd. – Rui F Ribeiro Jan 23 '18 at 17:07
  • @RuiFRibeiro disentangling a system from the borg is a lot of work. – cas Jan 24 '18 at 3:30
  • @cas I used to have 150+ Debian 9 servers with SysV. – Rui F Ribeiro Jan 24 '18 at 3:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.