서버가 이미 실행 중입니다. … / tmp / pids / server.pid를 확인하십시오. 종료-레일
..$ rails s
=> Booting WEBrick
=> Rails 4.0.4 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
A server is already running. Check /home/..name/rprojects/railsapp/tmp/pids/server.pid.
Exiting
Rails 초보자를 위해 이것을 해결하는 가장 쉬운 방법은 무엇입니까?
server.pid
파일을 삭제할 수 있습니다 .
rm /your_project_path/tmp/pids/server.pid
그밖에:
OSX에서 시도하십시오.
sudo lsof -iTCP -sTCP:LISTEN -P | grep :3000
또는 Linux :
ps -aef | 그렙 레일
또는
lsof -wni tcp:3000
사용하여 프로세스를 종료
kill -9 PID (eg,2786)
짧고 선명한 한 줄 명령이 처리됩니다.
kill -9 $(lsof -i tcp:3000 -t)
docker-compose를 사용하고 docker-compose.yml에 다음 volumes: - .:/myapp
이있는 경우 로컬 작업 영역이 컨테이너의 / myapp 폴더에 매핑됩니다.
/ myapp의 모든 항목은 정의 된 볼륨에 대해 삭제되지 않습니다.
./tmp/pids/server.pid
로컬 컴퓨터에서 삭제할 수 있습니다 . 그러면 컨테이너의 / myapp에이 파일이 없습니다.
server.pid
실행중인 서버의 프로세스 ID 만 포함합니다.
당신이 할 경우 :
more /your_project_path/tmp/pids/server.pid
kill 명령으로 이전 서버를 중지하는 데 사용할 수있는 번호 (예 : 6745)를 얻게됩니다.
kill -9 6745
그런 다음 rm
명령을 사용 하여 파일을 제거 할 수 있습니다.
rm /your_project_path/tmp/pids/server.pid
단순한:
이 경우 프로젝트의 루트 폴더로 이동하여 다음을 실행하십시오.
gem install shutup
shutup
이것은 현재 실행중인 프로세스를 찾아서 죽이고 pid 파일을 정리합니다.
참고 : rvm을 사용하는 경우 전역 적으로 gem을 설치하십시오.
rvm @global do gem install shutup
서버가 server.pid에 로그인 할 충분한 시간이 없도록 OS / 머신을 수동으로 끄는 것과 같이 강제로 서버를 끄는 경우가 있습니다.
한 가지 쉬운 방법은 tmp/pids/
(콘솔에 표시된 디렉토리 )로 수동으로 이동하여 server.pid
파일을 제거하는 것 입니다. 그런 다음 서버를 다시 시작 rails server
하거나 rails s
, 새 server.pid를 생성하고 개발을 계속할 수 있습니다.
다음을 사용하여 문제를 해결할 수 있습니다.
kill -9 $(more /home/..name/rprojects/railsapp/tmp/pids/server.pid)
Windows 사용자를 위한 GUI 방식
ResourceMonitor (작업 관리자-> 성능-> ResourceMonitor)를 열고 ruby.exe 프로세스를 종료하십시오.
path/to/your/rails/project/tmp/pids/server.pid
파일을 엽니 다 .
거기에서 찾은 번호를 복사하십시오.
운영 kill -9 [PID]
파일 [PID]
에서 복사 한 번호는 어디에 있습니까 server.pid
?
이렇게하면 실행중인 서버 프로세스가 종료되고 문제없이 서버를 다시 시작할 수 있습니다.
다음 명령을 사용하여 server.pid를 종료하십시오.
kill -9 `cat /root/myapp/tmp/pids/server.pid`
참고 : 콘솔 / 터미널에 표시되는 server.pid 경로를 사용하십시오.
감사합니다.
추가 정보는 Docker에서 응용 프로그램을 실행하는 컨텍스트에서.
docker-compose.yml 파일의 애플리케이션 컨테이너 자체 아래에서 다음 중 하나를 사용할 수 있습니다.
command: ["rm /your-app-path/tmp/pids/server.pid && bundle exec bin/rails s -p 3000 -b '0.0.0.0'"]
또는
command: ["rm /your-app-path/tmp/pids/server.pid; foreman start"]
Note the use of either ;
or &&
, that &&
will send an exit signal if rm
fails to find the file, forcing your container to prematurely stop. Using ;
will continue to execute.
Why is this caused in the first place? The rationale is that if the server (puma/thin/whatever) does not cleanly exit, it will leave a pid in the host machine causing an exit error.
For portability rather than manually deleting the file on the host system, it's better to check if the file exists within scripted or compose file itself.
For this problem,
What i did is:
- Delete the Pids folder which is located under
app/tmp/
and then, close the terminal which we are running the current app and close the tab (in, browser window)
after that, again open the terminal by going inside the folder, and then do,
rails s
- 그런 다음 응용 프로그램을 실행하는 새 탭이 열립니다.
먼저 파일 내부의 컴버를 복사 한 다음 제거합니다. rm /your_project_path/tmp/pids/server.pid 그런 다음 다시 만듭니다. touch /YOUR_PROJECT_PATH/tmp/pids/server.pid 그것은 나를 위해 일했습니다.
터미널에서 아래 명령을 실행하십시오 (Linux 전용)
ps aux | grep rails
그리고
kill -9 [pid]
또 다른 방법
lsof -wni tcp:3000
그리고
kill -9 [PID]
'Nice programing' 카테고리의 다른 글
gem을 사용하여 Ubuntu에 Rails를 설치하는 방법 (0) | 2020.11.25 |
---|---|
Typescript로 객체 배열에 대한 인터페이스를 어떻게 정의 할 수 있습니까? (0) | 2020.11.25 |
Android 진행률 표시 줄의 높이를 설정하는 방법은 무엇입니까? (0) | 2020.11.25 |
프로그래밍 방식으로 SearchView를 닫는 방법은 무엇입니까? (0) | 2020.11.25 |
코드 생성 UIView에 UIBezierPath 그리기 (0) | 2020.11.25 |