1

I'm managing 6 servers, 3 of which fail to start Apache after a reboot. The thing these 3 have in common is that they all rely on MySQL/MariaDB for storage of system users (via libnss-mysql-bg). Apache has also been set up with mpm-itk, causing websites to run under their own system users. This causes me to believe that the reason Apache fails to start at boot is that it sees references to system users in the vHost files (AssignUserID) which it at that point can't find yet because MySQL hasn't finished starting up.

Unless someone can advise me a better solution, how do I make sure Apache only starts after MySQL is running? Apache also doesn't seem to have its own systemd service file.

The servers are all running Ubuntu 16.04.2 LTS with systemd.

RobinJ
  • 187
  • 3
  • 14
  • 1
    Possible duplicate of [How to set systemd service dependencies?](https://serverfault.com/questions/617823/how-to-set-systemd-service-dependencies) – Gerald Schneider Jun 08 '17 at 10:07
  • @GeraldSchneider Apache doesn't seem to have its own systemd service file, and I'm also open to other, potentially better, suggestions to work around this issue as I'm sure we're not the only one with this kind of setup. – RobinJ Jun 08 '17 at 10:42
  • On my Ubuntu 16.04 the apache service file is located in `/lib/systemd/system/apache2.service.d/`. I really don't know what could be a "better" solution than the systemd dependencies. – Gerald Schneider Jun 08 '17 at 11:46
  • @GeraldSchneider Right, somehow I managed to not find that file Weirdly enough for one of the servers setting it to start `After=mysql.service` doesn't seem to have done the trick. Which is especially weird since it literally has an identical setup to one of the other servers (setup and maintenance was performed by linking their shell sessions together and sending the same input to both). – RobinJ Jun 08 '17 at 16:52

0 Answers0