I have a web application that is started by
systemd. It uses Postgresql as database, so it rely on it. Here is the unit file of my web application (I have remove the un-relevant/sensitive parts):
[Unit] Description=xxxx Requires=postgresql.service After=network.target postgresql.service [Service] Type=simple PermissionsStartOnly=true SyslogIdentifier=xx-service User=yyy Group=zzz ExecStart=/opt/.../xx WorkingDirectory=/opt/xx StandardOutput=journal+console [Install] WantedBy=multi-user.target
Host os is Ubuntu server 16.04.
I recently had an event where the web application was not running in the morning when I returned to work. After checking the logs, I discovered the service was stopped by
postgresql had an update. Apparently
postgresql before the upgrade and restarted it rigth after the update. When I logged into the machine it was running.
systemd decided to stop my web application before stopping
postgresql, which is nice, but didn't restart the web app it after it restarted
How to instruct
systemd to restart the appliation after
postgresql service is restarted ?