I have a problem running a Gunicorn Web service using Systemd.
Here are the files I created in order to execute:
The shell script file (/home/ubuntu/mata.sh):
#!/usr/bin/env bash
cd /home/ubuntu/workspace/test-api
/home/ubuntu/workspace/mata_venv/bin/gunicorn --workers=4 app:app --bind 0.0.0.0:xxxx
Here's my .service file (/lib/systemd/system/mata.service):
[Unit]
Description=Test API Service
After=multi-user.target
Conflicts=getty@tty1.service
[Service]
User=ubuntu
Type=simple
ExecStart=/home/ubuntu/mata.sh
StandardInput=tty-force
[Install]
WantedBy=multi-user.target
Running the shell script on its own works well, but when running systemctl status mata.service
, I am getting the following message:
Started Test API Service
mata.service: Main process exited, code=exited, status=216/GROUP
mata.service: Unit entered failed state.
mata.service: Failed with result 'exit-code'.
Any idea?
systemctl status...
? You are starting it with systemctl, right? – Jeff Schaller Feb 19 '19 at 14:38Group=
definition here; is the implication thatUser=ubuntu
is failing because of that user's groups? (The other aspect of the duplicate answer relates to usingnobody
, and seems unrelated to me) – Jeff Schaller Feb 19 '19 at 15:03groups ubuntu
? – Jeff Schaller Feb 20 '19 at 14:50