searchd(Sphinx)运行文件:
#!/bin/sh
set -e
APP_PATH=/srv/application
TARGET_USER=user
exec chpst -u $TARGET_USER /usr/bin/searchd --pidfile --nodetach --config $APP_PATH/current/config/production.sphinx.conf
尾部/var/log/sphinx/current
2014-06-07_18:13:56.87885 precached 9 indexes in 0.497 sec
2014-06-07_18:13:57.13740 precached 9 indexes in 0.497 sec
2014-06-07_18:13:57.88113 precached 9 indexes in 0.497 sec
2014-06-07_18:13:57.89167 precached 9 indexes in 0.497 sec
2014-06-07_18:13:59.75555 precached 9 indexes in 0.497 sec
2014-06-07_18:13:59.81554 precached 9 indexes in 0.497 sec
2014-06-07_18:14:00.33466 precached 9 indexes in 0.497 sec
... it continues to write the same line until sv stop sphinx ...
一切正常,seachd 启动并响应查询。但如何使日志重复性降低?当我手动启动 Sphinx 时,它只打印一次“预缓存的 9 个索引”。
答案1
我非常确定您的问题是 searchd 派生并成为守护进程,在 runit 看来它已退出。因此 runsv 将继续重新启动 searchd,并且每次启动时它都会记录一条消息。
解决方案是通过 --nodetach 开关告诉 searchd 停留在前台。