{"thread":{"id":"21723","subject":"[PATCH] instaweb: restart server if already running","startedAt":"2009-11-23T07:09:12Z","lastAt":"2009-11-23T07:09:12Z","messageCount":1,"participants":["Stephen Boyd"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"128155","messageId":"1258960152-24444-1-git-send-email-bebarino@gmail.com","threadId":"21723","inReplyTo":null,"subject":"[PATCH] instaweb: restart server if already running","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2009-11-23T07:09:12Z","receivedAt":"2009-11-23T07:09:12Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"Running 'git instaweb' when an instaweb server is already running will\nfail (at least when the port is the same) and overwrite the pid file\nused to track the currently running server. This turns out to be\nespecially annoying when the user tries to stop the previously running\nserver with 'git instaweb --stop' and is instead greeted with an error\nmessage because the pid file has been destroyed.\n\nInstead of allowing a user to start two instaweb servers, stop the\ncurrently running server first and then start the new one. This should\nbe fine because it was never really possible to start two instaweb\nservers in the first place due to the pid file issue outlined above.\n\nSigned-off-by: Stephen Boyd <bebarino@gmail.com>\n---\n git-instaweb.sh |    5 +++++\n 1 files changed, 5 insertions(+), 0 deletions(-)\n\ndiff --git a/git-instaweb.sh b/git-instaweb.sh\nindex 622a5f0..ffc2ab6 100755\n--- a/git-instaweb.sh\n+++ b/git-instaweb.sh\n@@ -73,6 +73,11 @@ resolve_full_httpd () {\n }\n \n start_httpd () {\n+\tif test -f \"$fqgitdir/pid\"; then\n+\t\tsay \"Instance already running. Restarting...\"\n+\t\tstop_httpd\n+\tfi\n+\n \t# here $httpd should have a meaningful value\n \tresolve_full_httpd\n \n-- \n1.6.5.3.299.gb65c9\n"}]}