2012-09-19 2 views
0

Monit을 사용하여 충돌이 발생할 때 일부 레일 응용 프로그램을 모니터링하고 다시 시작하려고합니다. 앱은 스핑크스를 사용합니다. Monit은 일반적으로 쉘에서 작동하는 명령을 받아들이지 않습니다.레일 응용 프로그램을 테스트 Monit monitrc 파일을 얻으려면

monitrc 구성은 다음과 같이 보입니다 : 거부 된 pidfile에 액세스 할 수

... 
check process app_name 
    with pidfile "/path/to/pidfile/searchd.production.pidfile" 
    start program = sudo su user_name -c "cd /home/app_name/current 
    && RAILS_ENV=production rake ts:start" 
    stop program = sudo su user_name -c "cd /home/app_name/current 
    && RAILS_ENV=production rake ts:stop" 
... 

권한을하지만 난 시도하는 경우 :

with pidfile "sudo /path/to/pidfile/searchd.production.pidfile" 

는 작업을 나던.

마찬가지로 monit은 시작 및 중지 프로그램 bash 명령을 허용하지 않습니다.

확실한 해결 방법이 있습니까? 나는 그런데 멍청한 놈입니다.

나는 또한 http://capitate.rubyforge.org/recipes/sphinx-monit.html#sphinx:monit:start을 보았지만 실제로 얻지는 못했다.

답변

0

rake에 전화하기 전에 bundle exec을 배치하십시오. 이처럼 :

start program = sudo su user_name -c "cd /home/app_name/current 
    && RAILS_ENV=production bundle exec rake ts:start" 
stop program = sudo su user_name -c "cd /home/app_name/current 
    && RAILS_ENV=production bundle exec rake ts:stop" 

이 내 puma 서버 내 프로덕션 서버에 delayed_job 근로자를 모니터링 할 수있는 주요 원인이었다.

갱신 :

내 작업 예 :

check process puma with pidfile <%= puma_pidfile %> 
    start program = "/bin/su - ubuntu -c 'cd /home/ubuntu/apps/artvasion/current && bundle exec puma -C config/puma.rb'" 
    stop program = "/bin/su - ubuntu -c 'kill `cat /home/ubuntu/apps/artvasion/shared/pids/puma.pid`'" 
    # ...monitoring stuff 
+0

감사 데이브하지만 문제가 예를 들어, 내가 대신'/ 빈/bash는 su' 필요 제한된 언어를 Monits에 고유의 생각 'su' – user1642579

+0

물론입니다. 내 푸마 설정 내 대답을 업데이 트되었습니다. 그것은 당신이 묘사하는 방식으로'su'를 사용합니다. – DaveTsunami