I have the following systemd unit file for a Python server using Gunicorn, located at /etc/systemd/system/gunicorn-fizzbuzz.service
:
[Unit]
Description=Gunicorn server for FizzBuzz
[Service]
Restart=on-failure
User=deploy
WorkingDirectory=/home/deploy/current/fizzbuzz
EnvironmentFile=/home/deploy/current/fizzbuzz/env/env-fizzbuzz
ExecStart=/home/deploy/current/fizzbuzz/.venv/bin/gunicorn \
--bind unix:/tmp/fizzbuzz.socket \
fizzbuzz.wsgi:application
[Install]
WantedBy=multi-user.target
When I try to enable this service with systemctl daemon-reload && systemctl enable gunicorn-fizzbuzz.service
, I get the error Failed to lookup unit file state: Invalid argument
. Apparently this is a generic systemd error message indicating that something is wrong with my unit file.
I have checked
- that a user named
deploy
exists - that
/home/deploy/current/fizzbuzz
exists - that
/home/deploy/current/fizzbuzz/env/env-fizzbuzz
exists - that the
ExecStart
command works
Can anyone see how this unit file is incorrect? I am running Ubuntu 18.04 with version 4.15.0-144-generic of the Linux kernel.