Systemd .service file not working
Solution 1:
code=exited, status=200/CHDIR
is your key error message.
It indicates that /var/www/rest-api/dist
doesn't exist or is not accessible at the time your service is attempting to run.
If it's mounted over the network, After=network.target
does not necessarily mean that any given network mount has been mounted. It's even possible that a slow to start local drive might not be mounted yet.
To see if you're experiencing a race condition, try adding a delay or possibly using RequiresMountsFor=
, or even ConditionPathExists=
.
source: https://www.freedesktop.org/software/systemd/man/systemd.unit.html