Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

2.3K
Visualizações
How to resolve (code=exited,status=203/Exec) while creating a system service for Flask app

I am trying to deploy a flask app using uWSGI and nginx using system service. I saw many tutorials and all of them have the same processes except for the change in .service file.

This is my service file:

[Unit]
Description=Flask web server

[Install]
WantedBy=multi-user.target

[Service]
User=schirag
PermissionsStartOnly=true
ExecStart=/home/schirag/server.py
TimeoutSec=600
Restart=on-failure
RuntimeDirectoryMode=755

I am getting the status of the service file as follows:

flask.service - Flask web server
   Loaded: loaded (/etc/systemd/system/flask.service; disabled; vendor preset: disable>
   Active: failed (Result: exit-code) since Wed 2021-08-11 11:20:25 IST; 6s ago
  Process: 13131 ExecStart=/home/schirag/server.py (code=exited, status=203/EXEC)
 Main PID: 13131 (code=exited, status=203/EXEC)
Aug 11 11:20:24 localhost.localdomain systemd[1]: flask.service: Main process exited, code=exited, status=203/EXEC
Aug 11 11:20:24 localhost.localdomain systemd[1]: flask.service: Failed with result 'exit-code'.
Aug 11 11:20:25 localhost.localdomain systemd[1]: flask.service: Service RestartSec=100ms expired, scheduling restart.
Aug 11 11:20:25 localhost.localdomain systemd[1]: flask.service: Scheduled restart job, restart counter is at 5.
Aug 11 11:20:25 localhost.localdomain systemd[1]: Stopped Flask web server.
Aug 11 11:20:25 localhost.localdomain systemd[1]: flask.service: Start request repeated too quickly.
Aug 11 11:20:25 localhost.localdomain systemd[1]: flask.service: Failed with result 'exit-code'.
Aug 11 11:20:25 localhost.localdomain systemd[1]: Failed to start Flask web server.

I have tried changing the service file from other sources and also tried changing the directory permissions, still getting the same error and can't start the app using the service. Although I can run the app manually using uwsgi using the following command - uwsgi --socket 0.0.0.0:8000 --protocol=http -w wsgi

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Your ExecStart needs to updated. You have to provide both the location of the file and the interpreter. Since you are using python, your code should be in this way:

[Unit]
Description=Flask web server

[Service]
User=schirag
PermissionsStartOnly=true
ExecStart=/usr/bin/python3 /home/schirag/server.py
TimeoutSec=600
Restart=on-failure
RuntimeDirectoryMode=755

[Install]
WantedBy=multi-user.target

Use the command type python3 to get the location of the python.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda