9

I want to use uwsgi with my django project
I test usgi --ini uwsgi.ini works well

And I want to write in systemd to control it
And face error

Here is my file

/etc/systemd/system/mysite.service

[Unit]
Description=uWSGI for proj
After=syslog.target

[Service]
Restart=always
ExecStart=/usr/bin/uwsgi --ini  /usr/share/nginx/ENV/proj/proj/uwsgi.ini
StandardError=syslog
KillSignal=SIGQUIT
Type=forking
NotifyAccess=main

[Install]
WantedBy=multi-user.target

first time I use systemctl restart mysite.service
it works well ,and then I use systemctl stop mysite.service
and then restart again with systemctl restart mysite.service

But it can't restart after stop it
I got error :

proj.service - uWSGI for proj
   Loaded: loaded (/usr/lib/systemd/system/proj.service; disabled)
   Active: failed (Result: start-limit) since Fri 2015-11-13 13:40:35 CST; 887ms ago
  Process: 4297 ExecStart=/usr/bin/uwsgi --ini /usr/share/nginx/ENV/proj/proj/uwsgi.ini (code=exited, status=0/SUCCESS)
 Main PID: 4298 (code=exited, status=0/SUCCESS)

Nov 13 13:40:35 localhost.localdomain systemd[1]: proj.service holdoff time over, scheduling restart.
Nov 13 13:40:35 localhost.localdomain systemd[1]: Stopping uWSGI for proj...
Nov 13 13:40:35 localhost.localdomain systemd[1]: Starting uWSGI for proj...
Nov 13 13:40:35 localhost.localdomain systemd[1]: proj.service start request repeated too quickly, refusing to start.
Nov 13 13:40:35 localhost.localdomain systemd[1]: Failed to start uWSGI for proj.
Nov 13 13:40:35 localhost.localdomain systemd[1]: Unit proj.service entered failed state.
[root@localhost ~]# vim /lib/systemd/system/proj.service

Please help me

Thanks

F1Linux
  • 2,476

2 Answers2

4

proj.service start request repeated too quickly, refusing to start.

This message is telling you, that you are restarting the service too frequently and systemd has integrated mechanism to detect it and block before the too many restarts will cause some trouble.

There are options StartLimitInterval= and StartLimitBurst= which modifies this behavior. You can read more in manual page.

For this case, just add them in your /etc/systemd/system/mysite.service under the [Unit] section.

jox
  • 133
Jakuje
  • 21,357
  • To improve on this answer, how doI set those options? (This could help others on the "TLDR;" manual page) – Shailen Apr 17 '18 at 22:45
3
Type=forking
NotifyAccess=main

This is another readiness protocol mismatch. The doco tells you that the program speaks the systemd text-message readiness protocol.

Type=notify
NotifyAccess=all

Further reading

JdeBP
  • 68,745