2011-03-18 2 views
0

업로드 할 때 이미지의 엄지 손톱을 처리하기 위해 Beanstalkd 작업자 스크립트 (Pheanstalk library 사용)를 만들었으며 BluePill을 구현하여 작업자 스크립트를 모니터/데몬 화하지만 BluePill이 프로세스를 시작하지 못하고 시작과 진행 사이를 순환합니다 하위.BluePill로 PHP 스크립트를 모니터링하려면 어떻게해야합니까?

BluePill을 사용하여 PHP 스크립트를 모니터/데몬스트레이션 할 수 있습니까? Google을 통해 찾은 모든 설정 파일은 Rails 앱용입니다. 나는 Ruby를 PHP보다 선호하며 솔직히 BluePill 구문이 더 마음에 들었 기 때문에 수퍼바이저가 아닌 다른 것을 시도하고 싶었습니다. 그때 전경에 BluePill 스크립트를 실행하면

Bluepill.application("WorkerThumnail") do |app| 
    app.process("thumbnail_watch") do |process| 
    process.start_command = "/usr/local/bin/php /var/www/example.com/staging/shared/tasks/WorkerThumbnail.php" 
    process.pid_file = "/tmp/beanstalk_thumbnail_worker.pid" 
    process.daemonize = true 

    process.start_grace_time = 3.seconds 
    process.stop_grace_time = 5.seconds 
    process.restart_grace_time = 8.seconds 

    ########################################### 
    # Memory and CPU Usage checks to make sure 
    # we don't have a runaway 
    ########################################### 

    # Check every 20 seconds to make the CPU usage is below 5%; 
    # if 3 out of 5 checks failed then restart the process 
    process.checks :cpu_usage, :every => 20.seconds, :below => 5, :times => [3,5] 

    # Check every 10 seconds to make the Memory usage is below 100 MB; 
    # if 3 out of 5 checks failed then restart the process 
    process.checks :mem_usage, :every => 10.seconds, :below => 100.megabytes, :times => [3,5] 
    end 
end 

나는 다음과 같은 출력 내가 수동으로 처리

[warning]: [WorkerThumnail:thumbnail_watch] Executing start command: /usr/local/bin/php 
/var/www/example.com/staging/shared/tasks/WorkerThumbnail.php 
[info]: [WorkerThumnail:thumbnail_watch] Going from down => starting 
[info]: [WorkerThumnail:thumbnail_watch] Going from starting => down 
[warning]: [WorkerThumnail:thumbnail_watch] Executing start command: /usr/local/bin/php /var/www/example.com/staging/shared/tasks/WorkerThumbnail.php 
[info]: [WorkerThumnail:thumbnail_watch] Going from down => starting 
[info]: [WorkerThumnail:thumbnail_watch] Going from starting => down 
[warning]: [WorkerThumnail:thumbnail_watch] Executing start command: /usr/local/bin/php /var/www/example.com/staging/shared/tasks/WorkerThumbnail.php 
[info]: [WorkerThumnail:thumbnail_watch] Going from down => starting 
[info]: [WorkerThumnail:thumbnail_watch] Going from starting => down 
[warning]: [WorkerThumnail:thumbnail_watch] Executing start command: /usr/local/bin/php /var/www/example.com/staging/shared/tasks/WorkerThumbnail.php 
[info]: [WorkerThumnail:thumbnail_watch] Going from down => starting 
[info]: [WorkerThumnail:thumbnail_watch] Going from starting => down 
을 죽일 때까지 반복 반복 참조 :

여기 내 BluePill 스크립트입니다

+0

작업자 스크립트에 오류가 있습니까? CLI를 통해 수동으로 실행하면 어떻게됩니까? – mway

+0

또한 CLI 사용시 CWD가 BluePill을 통해 데몬으로 실행될 때와 다른 점을 염두에 두십시오. 따라서 상대 디렉토리를 사용하는 경우 적절하게 조정하십시오. :) – mway

+0

수동으로 프로세스를 시작하고 제대로 작업 큐에서 잡아 및 작업자 스크립트 괜찮을 것이라고 그래서 작업을 완료합니다. 또한 CLI 스크립트에서 전체 경로를 사용하는 것이 어려운 방법이라는 것을 배웠으므로 지금해야 할 일이 있습니다. – grafikchaos

답변

0

후자의 경우 :

CLI 사용시 CWD가 BluePill을 통해 데몬으로 실행될 때와 다른 점을 염두에 두십시오. 따라서 상대 디렉토리를 사용한다면 적절하게 조정하십시오.

실제 문제가되지 않으면 업데이트하십시오.

+0

에 대한 정답으로 받아 들여야합니다. CWD에 대한 전체적인 질문에 대한 원래 질문을 참고하십시오 CLI 응답에서 – grafikchaos

관련 문제