在新的 Ubuntu 10.4 实例上,我尝试使用该locate
命令仅收到错误
locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory
在其他系统上使用此命令我猜测这意味着数据库尚未构建(它是全新安装)。我相信它应该每天运行,但我如何将其排队以立即运行?
另外,“每日运行”是如何确定的?如果我有一个每次只打开一个小时的盒子,数据库会自己构建吗?
答案1
cron 作业在 中定义/etc/cron.daily/mlocate
。
要立即运行它:
sudo updatedb
或更好
sudo ionice -c3 updatedb
这更好,因为updatedb
设置在空闲I/O调度类,这样它就不会干扰(从 I/O 的角度来看)其他应用程序。从ionice
手册页:
-c class The scheduling class. 0 for none, 1 for real time, 2 for best-effort, 3 for idle. ........................ Idle A program running with idle io priority will only get disk time when no other program has asked for disk io for a defined grace period. The impact of idle io processes on normal system activity should be zero. This scheduling class does not take a priority argument. Presently, this scheduling class is permitted for an ordinary user (since kernel 2.6.25).