stop hg serve on os x
How do I stop hg serve in OS X (server 10.6)?
I started it from开发者_Go百科 the terminal not in daemon mode. It worked fine, then I wanted to make some changes, so I did ctrl-Z to stop it. When I tried to start it again, it says...
abort: cannot start server at ':8000': Address already in use
I assume the process is already running and hasn't let go of the port. But in the activity monitor I can't find and "serve" or "hg" or "mercurial" processes to kill.
Help?
Do the following to find out the process id:
hgt $ ps -eaf | grep hg
502 91004 90841 0 0:00.04 ttys007 0:00.11 /opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python /opt/local/bin/hg serve
502 91032 90841 0 0:00.00 ttys007 0:00.00 grep hg
Kill the process
kill -9 91004
Next time use Ctrl-C to stop the server. :)
Ctrl-Z
stops a process temporarily. If you stop something with Ctrl-Z
, you can start it again by running fg
to have it take over the terminal again, or bg
to have it running in the background of the terminal. Otherwise, you can kill the server using pyfunc's answer. You can tell if the server is still working by opening up localhost:8000
in your browser, of course.
Check for the listening port typically 8000 for hg server
sudo lsof -i -n -P | grep LISTEN | grep 8000
Check the PID for hg search for hg and then python
ps -aef | grep hg | grep python | awk '{print $2}'
Now kill the PID you found
sudo kill -9 `ps -aef | grep hg | grep python | awk '{print $2}'`
精彩评论