我正在运行一个Ubuntu的硬盘。 我已经安装了狮身人面像,我希望每x
分钟运行一次狮身人面像索引器。 什么是最好的方式去做这个?
标准的Unix方法是cron
,所以你可以编辑/etc/crontab
并添加一行
*/5 * * * * root sphynx [whatever other options you need]
意思是
另一个例子:每个星期六上午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