在ubuntu hardy中重新索引sphinx的最佳方法

2 linux ubuntu cron debian sphinx

我正在运行一块ubuntu hardy.我安装了sphinx,我想每x分钟运行一次sphinx索引器.这样做的最佳方法是什么?

Dir*_*tel 5

标准的Unix方法是cron,所以你可以编辑/etc/crontab和添加一行像

*/5 * * * *     root    sphynx [whatever other options you need]
Run Code Online (Sandbox Code Playgroud)

意思是

  • '每五分钟一次'(*/5部分)
  • 每小时(位置2的*)
  • 每月的每一天(位置3的*)
  • 每个月(位置4的*)
  • 一周中的每一天(最终*在第5位)

另一个例子:'4 5**6'相当于每周六上午5:04(五点钟后四分钟)(一周中的一天是6).

您可能需要或想要将用户从root切换到,例如,www-data是sphynx运行的那样,您显然需要调整参数.

最后,查看目录

$ ls -1d /etc/cron.*
/etc/cron.d
/etc/cron.daily
/etc/cron.hourly
/etc/cron.monthly
/etc/cron.weekly
Run Code Online (Sandbox Code Playgroud)

例如---其他包把他们的工作放在那里(这种机制比直接编辑更通用,更新/etc/crontab.