4

Trying to set up gunicorn to run with systemd. The control file is /etc/systemd/system/gunicorn.service and the output for testing is

root@samuel-pc:~# systemctl start gunicorn
Failed to start gunicorn.service: Unit gunicorn.service is not loaded properly: Invalid argument.
See system logs and 'systemctl status gunicorn.service' for details.


root@samuel-pc:~# systemctl status gunicorn.service
● gunicorn.service - gunicorn daemon
   Loaded: error (Reason: Invalid argument)
   Active: inactive (dead)

Jun 29 05:13:17 samuel-pc systemd[1]: [/etc/systemd/system/gunicorn.service:9] Executable path is not absolute, ignoring: gunicorn --access-logfile - --workers 3 --bind unix:/root/revamp/revamp
Jun 29 05:13:17 samuel-pc systemd[1]: gunicorn.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Jun 29 05:13:29 samuel-pc systemd[1]: [/etc/systemd/system/gunicorn.service:9] Executable path is not absolute, ignoring: gunicorn --access-logfile - --workers 3 --bind unix:/root/revamp/revamp
Jun 29 05:13:29 samuel-pc systemd[1]: gunicorn.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Jun 29 05:15:45 samuel-pc systemd[1]: [/etc/systemd/system/gunicorn.service:9] Executable path is not absolute, ignoring: gunicorn --access-logfile - --workers 3 --bind unix:/root/revamp/revamp
Jun 29 05:15:45 samuel-pc systemd[1]: gunicorn.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Jun 29 07:01:10 samuel-pc systemd[1]: [/etc/systemd/system/gunicorn.service:9] Executable path is not absolute, ignoring: gunicorn --access-logfile - --workers 3 --bind unix:/root/revamp/revamp
Jun 29 07:01:10 samuel-pc systemd[1]: gunicorn.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Jun 29 07:01:55 samuel-pc systemd[1]: [/etc/systemd/system/gunicorn.service:9] Executable path is not absolute, ignoring: gunicorn --access-logfile - --workers 3 --bind unix:/root/revamp/revamp
Jun 29 07:01:55 samuel-pc systemd[1]: gunicorn.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.

which shows the error starts in line 9 of the gunicorn service because of the ExecStart

[Unit]
Description=gunicorn daemon
After=network.target

[Service]
User=root
Group=www-data
WorkingDirectory=/root/revamp
ExecStart=gunicorn --access-logfile - --workers 3 --bind unix:/root/revamp/revamp.sock revamp.wsgi:application


[Install]
WantedBy=multi-user.target
the
  • 21,007
  • 11
  • 68
  • 101
Samuel Muiruri
  • 492
  • 1
  • 8
  • 17

1 Answers1

12

It's telling you that it doesn't want a relative path for the gunicorn executable:
Executable path is not absolute, ignoring.

You need to change it to the absolute path of your gunicorn executable, either:

  • System's executable: ExecStart=/usr/local/bin/gunicorn
  • Your virtual environment's executable: ExecStart=/path/to/venv/bin/gunicorn

You can check this gist: Using Systemd to Make Sure Gunicorn Starts on Boot, for a minimal gunicorn systemd service config file.

Hope this helps!

the
  • 21,007
  • 11
  • 68
  • 101
HassenPy
  • 2,083
  • 1
  • 16
  • 31