【发布时间】:2010-11-16 05:13:08
【问题描述】:
我正在运行一块 ubuntu hardy。
我已经安装了 sphinx,我想每隔x 分钟运行一次 sphinx 索引器。
这样做的最佳方法是什么?
【问题讨论】:
标签: linux ubuntu cron debian sphinx
我正在运行一块 ubuntu hardy。
我已经安装了 sphinx,我想每隔x 分钟运行一次 sphinx 索引器。
这样做的最佳方法是什么?
【问题讨论】:
标签: linux ubuntu cron debian sphinx
标准的 Unix 方法是 cron,因此您可以编辑 /etc/crontab 并添加类似的行
*/5 * * * * root sphynx [whatever other options you need]
意思是
另一个例子:'4 5 * * 6' 等于 'at 5:04am(五点后四分钟)每周六(一周中的第 6 天)。
您可能需要或想要将用户从 root 切换到,例如 www-data is sphynx 运行,您显然需要调整参数。
最后,查看目录
$ ls -1d /etc/cron.*
/etc/cron.d
/etc/cron.daily
/etc/cron.hourly
/etc/cron.monthly
/etc/cron.weekly
例如 --- 其他软件包将它们的工作放在那里(而且这种机制比直接编辑 /etc/crontab 更通用、更新。
【讨论】:
这是我重新索引然后每天重新启动搜索守护程序一次的操作。
* * /1 * * root cd /home/sphinx && bin/indexer --all --rotate && bin/searchd --stop && bin/searchd
【讨论】: