데몬으로 newrelic 플러그인을 시작하기 위해 init.d 스크립트를 작성했습니다. 문제는 내가 service rb_nr_agent start
을 실행할 때 "require"와 관련된 몇 가지 오류가 있다는 것입니다. 출력 :Init.d 스크립트에 필요합니다.
[[email protected] newrelic_rb_plugin]# /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- snmp (LoadError)
from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /opt/newrelic_rb_plugin/newrelic_redborder_agent:5:in `<main>'
[[email protected] newrelic_rb_plugin]# ./rb_nr_agent start Starting rb_nr_agent:[ OK ]
이 제대로 시작되지 않습니다. 동일한 스크립트를 실행했지만 프로젝트의 루트 경로에서 오류가 발생하지 않고 정상적으로 작동합니다. init.d는 그 사본입니다.
start() {
RESULT=`ps aux | grep $executable | grep -c -v grep`
if [ "${RESULT:-null}" -ge "1" ]; then
echo "$prog is currently running"
else
echo -n "Starting $prog: "
/opt/newrelic_rb_plugin/newrelic_redborder_agent > /dev/null &
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo_success
else
echo_failure; failure
RETVAL=1
fi
echo
fi
return $RETVAL }
당신의 대상 파일 (/ opt/newrelic_rb_plugin/newrelic_redborder_agent)은''puts $ LOAD_PATH''를 추가하고''service ... start''를 사용하여 실행합니다. 그 후에 다시 작동 방식을 실행하고 차이점이 있는지 확인하십시오. –