Question
gunicorn gives me "invalid argument" error and cannot be reloaded.
On my droplet I have installed and configured a django website successfully. My client asked me to re-do the project (it was a very old project). So I created another django website on this droplet for testing purposes (for my client to see the new version of the old site before deleting the old one and the new one going live) and added a new domain entry (i.e. stage.example.com) pointing to this droplet.
I edited gunicorn.service file and added this section:
[Service]
User=myuser
Group=www-data
WorkingDirectory=/home/myuser/project2
ExecStart=/home/myuser/.virtualenvs/project2env/bin/gunicorn –workers 3 –bind unix:/home/myuser/project2/project2.sock project2.wsgi:application
Question 1: Is this allowed? To add two [Service] sections in gunicorn.service file?
Anyway, I tried to reload gunicorn and got this error message:
Failed to restart gunicorn.service: Unit gunicorn.service is not loaded properly: Invalid argument.
See system logs and 'systemctl status gunicorn.service' for details.
I opened /var/log/syslog and I noticed this:
Jun 9 08:57:59 project1-fra1 systemd[1]: Reloading.
Jun 9 08:58:00 project1-fra1 systemd[1]: gunicorn.service: Service has more than one ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.
Jun 9 08:58:00 project1-fra1 systemd[1]: apt-daily.timer: Adding 11h 23.852822s random time.
Jun 9 08:58:00 project1-fra1 systemd[1]: snapd.refresh.timer: Adding 4h 8min 5.201022s random time.
Jun 9 08:58:00 project1-fra1 systemd[1]: Started ACPI event daemon.
Jun 9 09:00:22 project1-fra1 systemd[1]: Stopping A high performance web server and a reverse proxy server...
Jun 9 09:00:22 project1-fra1 systemd[1]: Stopped A high performance web server and a reverse proxy server.
Jun 9 09:00:22 project1-fra1 systemd[1]: Starting A high performance web server and a reverse proxy server...
Jun 9 09:00:22 project1-fra1 systemd[1]: nginx.service: Failed to read PID from file /run/nginx.pid: Invalid argument
Jun 9 09:00:22 project1-fra1 systemd[1]: Started A high performance web server and a reverse proxy server.
I removed the second section from gunicorn.service file and tried to reload the gunicorn service, but although the site is working as normal, I still receive the same “Invalid Argument” error message.
Question 2: What did I do wrong? Is this fixable? How?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×