最好的方式来重新索引狮身人面像在Ubuntu的耐寒

我正在运行一个Ubuntu的硬盘。 我已经安装了狮身人面像,我希望每x分钟运行一次狮身人面像索引器。 什么是最好的方式去做这个?

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

 */5 * * * * root sphynx [whatever other options you need] 

意思是

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

另一个例子:每个星期六上午5点04分(五点四分钟后),“4 5 * * 6”等于“(星期几为6)”。

您可能需要或想要将用户从根切换到,例如www-data是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