Point. On the other hand, I'm suggesting a small incremental improvement. In order of difficulty:
1. Move mlocate to /etc/cron.weekly/. (Very easy.) 2. Only update system dirs (i.e. /) if dpkg has been run. (Easy.) 3. Split updates of / and /home. (Hard.) 4. Update system dirs when dpkg is run. 4a. Parse /var/log/dpkg.log and see what's been done since previous update invocation. (Hard) 4b. Asynchronously tie into dpkg invocation so as to keep database up-to-date with no latency. (Very hard.) For something as minor as the locate database, I'm not suggesting we put in a lot of work; it'll be diminishing returns very shortly. However, I believe that 1, 2, and 3 are doable. We can easily integrate 1. For 2, I can give you the logic of *when* to update /, but actually doing it is reliant on 3. See below. For 3, I can update /home, or / and /home, but not just /. I'm unable to update *just* the system dirs. Hopefully someone else will be able to figure out what I'm not seeing. For the here-and-now, I note the existence of /var/log/dpkg.*. An enterprising someone could use the date of those files, or parsing the final line of dpkg.log as a measure of when to update. That would be a very simple addition to the mlocate script. For example, here's an example script to only update the system dirs if necessary: #!/bin/sh DPKG_FILE='/var/log/dpkg.log' UPD_FILE='/var/log/last_updatedb' if [ ! -f "$UPD_FILE" ]; then touch -t 197001010000.00 "$UPD_FILE" # Didn't exist, initialize to "zero" echo "Locate database not yet created." fi LAST_APT_USAGE=`date -r "$DPKG_FILE" +"%s"` # output in epoch seconds LAST_UPDATE=`date -r "$UPD_FILE" +"%s"` # output in epoch seconds if [ $LAST_UPDATE != $LAST_APT_USAGE ]; then # The timestamps of files suggest the database is not in sync. So ... # 1. Update the database # The part I don't know how to do is to only update entries relating # to a single directory or filesystem, so I leave that part to someone else. # 2. Locate database now in sync. Let next invocation know when: touch --reference "$DPKG_FILE" "$UPD_FILE" fi -- updatedb should be weekly, not daily https://bugs.launchpad.net/bugs/271272 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs