{"action":"created","issue":{"url":"https://api.github.com/repos/mholt/caddy/issues/675","repository_url":"https://api.github.com/repos/mholt/caddy","labels_url":"https://api.github.com/repos/mholt/caddy/issues/675/labels{/name}","comments_url":"https://api.github.com/repos/mholt/caddy/issues/675/comments","events_url":"https://api.github.com/repos/mholt/caddy/issues/675/events","html_url":"https://github.com/mholt/caddy/issues/675","id":140474662,"number":675,"title":"Re-enabling prometheus middleware after restart","user":{"login":"miekg","id":353371,"avatar_url":"https://avatars.githubusercontent.com/u/353371?v=3","gravatar_id":"","url":"https://api.github.com/users/miekg","html_url":"https://github.com/miekg","followers_url":"https://api.github.com/users/miekg/followers","following_url":"https://api.github.com/users/miekg/following{/other_user}","gists_url":"https://api.github.com/users/miekg/gists{/gist_id}","starred_url":"https://api.github.com/users/miekg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miekg/subscriptions","organizations_url":"https://api.github.com/users/miekg/orgs","repos_url":"https://api.github.com/users/miekg/repos","events_url":"https://api.github.com/users/miekg/events{/privacy}","received_events_url":"https://api.github.com/users/miekg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-03-13T10:50:18Z","updated_at":"2016-03-13T17:12:36Z","closed_at":null,"body":"*If you are filing a bug report, please answer these questions. If your issue is not a bug report, you do not need to use this template. Either way, please consider donating if we've helped you. Thanks!*\r\n\r\n#### 1. What version of Caddy are you running (`caddy -version`)?\r\ncaddy dev version (build from master)\r\n\r\n#### 2. What are you trying to do?\r\nRe-enabling the prometheus handler after a restart (SIGUSR1)\r\n\r\n#### 3. What is your entire Caddyfile?\r\n```text\r\nlocalhost:2020 {\r\n    prometheus\r\n}\r\n\r\nlocalhost:2021 {\r\n    prometheus\r\n}\r\n```\r\n\r\n#### 4. How did you run Caddy (give the full command and describe the execution environment)?\r\n\r\n\r\n#### 5. What did you expect to see?\r\n\r\n\r\n#### 6. What did you see instead (give full error messages and/or log)?\r\nThe handler fails to run because of\r\n~~~\r\nerr listen tcp 127.0.0.1:9180: bind: address already in use\r\n~~~\r\nBut I can't stop the previous handler before the new caddy process starts, because there are no hook. I'm wondering what to do here?\r\nSeems the Shutdown function could help here, but that is *only* run on server stops, not restarts?\r\n\r\nHelp?"},"comment":{"url":"https://api.github.com/repos/mholt/caddy/issues/comments/196003306","html_url":"https://github.com/mholt/caddy/issues/675#issuecomment-196003306","issue_url":"https://api.github.com/repos/mholt/caddy/issues/675","id":196003306,"user":{"login":"miekg","id":353371,"avatar_url":"https://avatars.githubusercontent.com/u/353371?v=3","gravatar_id":"","url":"https://api.github.com/users/miekg","html_url":"https://github.com/miekg","followers_url":"https://api.github.com/users/miekg/followers","following_url":"https://api.github.com/users/miekg/following{/other_user}","gists_url":"https://api.github.com/users/miekg/gists{/gist_id}","starred_url":"https://api.github.com/users/miekg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miekg/subscriptions","organizations_url":"https://api.github.com/users/miekg/orgs","repos_url":"https://api.github.com/users/miekg/repos","events_url":"https://api.github.com/users/miekg/events{/privacy}","received_events_url":"https://api.github.com/users/miekg/received_events","type":"User","site_admin":false},"created_at":"2016-03-13T17:12:36Z","updated_at":"2016-03-13T17:12:36Z","body":"Ok, fair enough, I Restart hook makes a lot of sense. Hopefully other middleware would find this useful as well."}}