0

I am trying to create a website with my raspberry pi 1.0 with Nginx and gunicorn.

while configuring gunicorn i had to create the file myproject.service but when i try to execute this command:

systemctl enable myproject

is giving me an error (Failed to enable unit: Invalid argument) that I couldn't resolve with both of these solution --> What does "Failed to execute operation: Invalid argument" mean when running systemctl enable?

and --> Problems trying to enable/start custom target in systemd

but is still giving me this error.

the code etc/systemd/system/myproject.service file is this:

[Unit]
Description=Gunicorn instance to serve One
After=network.target
[Service]
User=root
Group=www-data
WorkingDirectory=/var/www/html
Environment="PATH=/var/www/html/myprojectenv/bin"
ExecStart=/var/www/html/myprojectenv/bin/gunicorn --workers 3 --bind unix:myproject.sock -m 007 wsgi:app
[Install]
WantedBy=multi-user.taget

and is also giving me these more specific error:

mar 08 17:18:51 justonepassword gunicorn[1623]: [2021-03-08 17:18:50 +0100] [1626] [INFO] Booting worker with pid: 1626
mar 08 17:18:51 justonepassword gunicorn[1623]: [2021-03-08 17:18:51 +0100] [1627] [INFO] Booting worker with pid: 1627
mar 08 17:32:14 justonepassword systemd[1]: /etc/systemd/system/myproject.service:1: Missing '='.
mar 08 17:33:00 justonepassword systemd[1]: /etc/systemd/system/myproject.service:1: Assignment outside of section. Ignoring.
mar 08 17:33:00 justonepassword systemd[1]: /etc/systemd/system/myproject.service:2: Assignment outside of section. Ignoring.
mar 08 17:33:00 justonepassword systemd[1]: /etc/systemd/system/myproject.service:3: Assignment outside of section. Ignoring.
mar 08 17:33:07 justonepassword systemd[1]: /etc/systemd/system/myproject.service:1: Missing '='.
mar 08 17:40:04 justonepassword systemd[1]: /etc/systemd/system/myproject.service:1: Assignment outside of section. Ignoring.
mar 08 17:40:04 justonepassword systemd[1]: /etc/systemd/system/myproject.service:2: Assignment outside of section. Ignoring.
mar 08 17:40:04 justonepassword systemd[1]: /etc/systemd/system/myproject.service:3: Assignment outside of section. Ignoring.

I have tried to search and fix this but there is always something

I am trying to follow this tutorial --> https://youtu.be/o2WA-A67Bks

if you have any help is always appreciated

2 Answers2

0

just do this

[Unit]
Description= #here service info

[Service]
After=network.target
Type=simple
Restart=always
User=root
ExecStart=/bin/bash -c '/var/www/html/myprojectenv/bin/gunicorn --workers 3 --bind unix:myproject.sock -m 007 wsgi:app'

[Install]
WantedBy=multi-user.targe
0

Assuming your example is accurate, the last line should be:

WantedBy=multi-user.target

With a trailing t (.target not .targe). Assuming its a cut-and-paste error in dropping the last character. Happens too often.

Just had to figure out one of these myself.

alea
  • 980
  • 1
  • 13
  • 18
Greg
  • 1