Command-Line
如何啟用定位和排隊要建構的數據庫?
在一個新的 Ubuntu 10.4 實例上,我嘗試使用該
locate
命令僅收到錯誤locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory
從在其他系統上使用此命令我猜這意味著數據庫尚未建構(它是全新安裝)。我相信它應該每天執行,但我如何將它排隊以立即執行?
另外,如何確定“每日跑步”?如果我有一個每次只打開一個小時的盒子,數據庫會建立在它自己的基礎上嗎?
cron 作業在
/etc/cron.daily/mlocate
.要立即執行它:
sudo updatedb
或更好
sudo ionice -c3 updatedb
這更好,因為
updatedb
在Idle 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).