2.5. Real time indexing

Real time monitoring/indexing is performed by starting the recollindex -m command. With this option, recollindex will detach from the terminal and become a daemon, forever monitoring file changes and updating the index.

The package must have been configured with option --with-fam or --with-inotify for the monitoring code and option to be enabled in recollindex. This is not currently the default.

The rclmon.sh script can be used to easily start and stop the daemon. It can be found in the examples directory (typically /usr/local/[share/]recoll/examples).

Starting and stopping the daemon could be performed, for example, as part of the user session script. For example, my out of fashion xdm-based session has a .xsession script with the following lines at the end:

recollconf=$HOME/.recoll-home
recolldata=/usr/local/share/recoll
RECOLL_CONFDIR=$recollconf $recolldata/examples/rclmon.sh start

fvwm 

RECOLL_CONFDIR=$recollconf $recolldata/examples/rclmon.sh stop

The indexing daemon gets started, then the window manager, for which the session waits. When the window manager exits, the indexing daemon is stopped, then the session ends (at script exit). This should be adjusted for your flavour of session management, and of course, there are other possibilities.

Under KDE, you can place a small script to start recollindex -m under $HOME/.kde/Autostart. This will be executed when the session begins, and the process seems to get a SIGHUP signal and be terminated when the session ends.

There is a similar mechanism under Gnome (find the session control tool in the menus and use the "Startup programs" tab). I could find an easy way to stop recollindex at the end of the session though.

By default, the indexing daemon will write its messages to a file inside the configuration directory (this is controlled by the daemlogfilename and daemloglevel configuration parameters). You may want to change this. Also the log file will only be truncated when the daemon starts. If the daemon runs permanently, the log file may grow quite big, depending on the log level.

The real time indexing code is relatively young, and there are still a few quirks. File deletions occurring while the monitor is not running will not be detected. You'll have to run a normal incremental indexing pass from time to time to purge the database. There may still be other problems.