caddy.service start request repeated too quickly

99封情书 提交于 2019-12-05 22:32:16

问题


I'm using systemd to start a caddy webserver on an ubuntu 16.04 machine. Whenever I run sudo service caddy start and service caddy status, I get this error:

● caddy.service - Caddy webserver
   Loaded: loaded (/etc/systemd/system/caddy.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2016-08-29 05:03:02 EDT; 4s ago
     Docs: https://caddyserver.com/
  Process: 1135 ExecStart=/usr/local/bin/caddy -agree -email me@example -pidfile=/var/run/caddy/caddy.pid (code=exited, status
 Main PID: 1135 (code=exited, status=1/FAILURE)

systemd[1]: Started Caddy webserver.
caddy[1135]: Activating privacy features... done.
caddy[1135]: 2016/08/29 05:03:02 Caddyfile:12 - Parse error: unknown property 'errors'
systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: caddy.service: Unit entered failed state.
systemd[1]: caddy.service: Failed with result 'exit-code'.

回答1:


In my /etc/systemd/system/caddy.service file, I had the following line:

Restart=on-failure

Commenting that out (with # or ;) and restarting the service showed the underlying problem, which was in my Caddyfile.

EDIT:

service caddy status only prints a few lines from the log, so sometimes you can find the underlying problem by simply looking at the full log. If using syslog, this is done with:

journalctl -u caddy



回答2:


For anyone else pulling their hair out, note the lines StartLimitInterval and StartLimitBurst in the caddy.service file - if you're testing and repeatedly stop / starting you will hit the StartLimitBurst limit. Need to increase it to lots, or change the StartLimitInterval, to allow this.



来源:https://stackoverflow.com/questions/39202644/caddy-service-start-request-repeated-too-quickly

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!