1

I have two services: mysql and liferay. Liferay start depends on mysql but liferay's shutdwon also depends on mysql. The problem is that systemd will shutdown mysql before liferay's shutdown is over. When I run "systemctl stop mysql" it will start shutting down both services at the same time and liferay will have no mysql service to finish it's own shutdown.

I have Liferay's service declared like this:

[Unit]
Description=Liferay Portal
After=network.target,mysql.service
Requires=mysql.service

[Service] Type=forking WorkingDirectory=/opt/liferay ExecStart=/opt/liferay/liferay-ce-portal/tomcat/bin/startup.sh User=liferay Group=liferay Restart=always

[Install] WantedBy=multi-user.target

Any ideas?

TIA

Fernando

ferdez
  • 41

1 Answers1

0

As per Gerald's comment, it seems the answer is simply to remove the "Requires=".

This version does the trick:

[Unit]
Description=Liferay Portal
After=mysql.service

[Service] Type=forking WorkingDirectory=/opt/liferay ExecStart=/opt/liferay/liferay-ce-portal/tomcat/bin/startup.sh User=liferay Group=liferay Restart=always

[Install] WantedBy=multi-user.target

Thanks Gerald!

ferdez
  • 41