option -x to disable x11 session monitoring
This commit is contained in:
parent
43bf0beb52
commit
2ba0ea3254
13
src/configure
vendored
13
src/configure
vendored
@ -1454,6 +1454,12 @@ echo "$as_me: error: fam library not found" >&2;}
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -f /usr/include/sys/inotify.h -a X$withFam = Xno ; then
|
||||
inot_default=yes
|
||||
else
|
||||
inot_default=no
|
||||
fi
|
||||
|
||||
# Real time monitoring with inotify
|
||||
|
||||
# Check whether --with-inotify or --without-inotify was given.
|
||||
@ -1461,10 +1467,12 @@ if test "${with_inotify+set}" = set; then
|
||||
withval="$with_inotify"
|
||||
withInotify=$withval
|
||||
else
|
||||
withInotify=no
|
||||
withInotify=$inot_default
|
||||
fi;
|
||||
|
||||
if test X$withInotify != Xno ; then
|
||||
{ echo "$as_me:$LINENO: Enabled support for inotify monitoring" >&5
|
||||
echo "$as_me: Enabled support for inotify monitoring" >&6;}
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define RCL_MONITOR 1
|
||||
@ -1475,6 +1483,9 @@ cat >>confdefs.h <<\_ACEOF
|
||||
#define RCL_USE_INOTIFY 1
|
||||
_ACEOF
|
||||
|
||||
else
|
||||
{ echo "$as_me:$LINENO: inotify monitoring disabled" >&5
|
||||
echo "$as_me: inotify monitoring disabled" >&6;}
|
||||
fi
|
||||
|
||||
##### Look for iconv. We first look for libiconv in /usr/local/lib:/usr/lib
|
||||
|
||||
@ -91,15 +91,24 @@ if test X$withFam != Xno ; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -f /usr/include/sys/inotify.h -a X$withFam = Xno ; then
|
||||
inot_default=yes
|
||||
else
|
||||
inot_default=no
|
||||
fi
|
||||
|
||||
# Real time monitoring with inotify
|
||||
AC_ARG_WITH(inotify,
|
||||
AC_HELP_STRING([--with-inotify],
|
||||
[Use inotify for almost real time indexing of modified files.]),
|
||||
withInotify=$withval, withInotify=no)
|
||||
withInotify=$withval, withInotify=$inot_default)
|
||||
|
||||
if test X$withInotify != Xno ; then
|
||||
AC_MSG_NOTICE([enabled support for inotify monitoring])
|
||||
AC_DEFINE(RCL_MONITOR, 1, [Real time monitoring option])
|
||||
AC_DEFINE(RCL_USE_INOTIFY, 1, [Compile the inotify interface])
|
||||
else
|
||||
AC_MSG_NOTICE([inotify monitoring disabled])
|
||||
fi
|
||||
|
||||
##### Look for iconv. We first look for libiconv in /usr/local/lib:/usr/lib
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
.\" $Id: recollindex.1,v 1.4 2006-12-22 11:01:28 dockes Exp $ (C) 2005 J.F.Dockes\$
|
||||
.\" $Id: recollindex.1,v 1.5 2006-12-24 07:40:26 dockes Exp $ (C) 2005 J.F.Dockes\$
|
||||
.TH RECOLLINDEX 1 "8 January 2006"
|
||||
.SH NAME
|
||||
recollindex \- indexing command for the Recoll full text search system
|
||||
@ -23,6 +23,9 @@ recollindex \- indexing command for the Recoll full text search system
|
||||
[
|
||||
.B -D
|
||||
]
|
||||
[
|
||||
.B -x
|
||||
]
|
||||
.br
|
||||
.B recollindex
|
||||
[
|
||||
@ -90,7 +93,13 @@ is given, it will stay in the foreground. Option
|
||||
.B
|
||||
-w
|
||||
<seconds> can be used to specify that the program should sleep for the
|
||||
specified time before indexing. The default value is 60.
|
||||
specified time before indexing begins. The default value is 60. The daemon
|
||||
normally monitors the X11 session and exits when it is reset.
|
||||
Option
|
||||
.B
|
||||
-x
|
||||
disables this X11 session monitoring (daemon will stay alive even if it
|
||||
cannot connect to the X11 server).
|
||||
|
||||
.PP
|
||||
The other modes are useful mainly for testing.
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
Dockes</holder>
|
||||
</copyright>
|
||||
|
||||
<releaseinfo>$Id: usermanual.sgml,v 1.32 2006-12-22 11:01:28 dockes Exp $</releaseinfo>
|
||||
<releaseinfo>$Id: usermanual.sgml,v 1.33 2006-12-24 07:40:26 dockes Exp $</releaseinfo>
|
||||
|
||||
<abstract>
|
||||
<para>This document introduces full text search notions
|
||||
@ -423,7 +423,7 @@ recoll
|
||||
<para>Real time monitoring/indexing is performed by starting the
|
||||
<command>recollindex -m</command> command. With this option,
|
||||
<command>recollindex</command> will detach from the terminal and
|
||||
become a daemon, forever monitoring file changes and updating
|
||||
become a daemon, permanently monitoring file changes and updating
|
||||
the index.</para>
|
||||
|
||||
<para>The package must have been
|
||||
@ -431,8 +431,8 @@ recoll
|
||||
with option <literal>--with-fam</literal> or
|
||||
<literal>--with-inotify</literal> for the monitoring
|
||||
code and option to be enabled in
|
||||
<command>recollindex</command>. This is not currently the
|
||||
default.</para>
|
||||
<command>recollindex</command>. The default is currently to
|
||||
include inotify monitoring on systems that support it.</para>
|
||||
|
||||
<para>The <filename>rclmon.sh</filename> script can be used to
|
||||
easily start and stop the daemon. It can be found in the
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
#define _RCLMON_H_INCLUDED_
|
||||
#include "autoconfig.h"
|
||||
#ifdef RCL_MONITOR
|
||||
/* @(#$Id: rclmon.h,v 1.7 2006-11-07 16:51:45 dockes Exp $ (C) 2006 J.F.Dockes */
|
||||
/* @(#$Id: rclmon.h,v 1.8 2006-12-24 07:40:26 dockes Exp $ (C) 2006 J.F.Dockes */
|
||||
/**
|
||||
* Definitions for the real-time monitoring recoll.
|
||||
* We're interested in file modifications, deletions and renaming.
|
||||
@ -37,6 +37,8 @@ class RclMonEvent {
|
||||
RclMonEvent() : m_etyp(RCLEVT_NONE) {}
|
||||
};
|
||||
|
||||
enum RclMonitorOption {RCLMON_NONE=0, RCLMON_NOFORK=1, RCLMON_NOX11=2};
|
||||
|
||||
/**
|
||||
* Monitoring event queue. This is the shared object between the main thread
|
||||
* (which does the actual indexing work), and the monitoring thread which
|
||||
@ -60,6 +62,7 @@ class RclMonEventQueue {
|
||||
bool ok();
|
||||
bool empty();
|
||||
RclMonEvent pop();
|
||||
void setopts(int opts);
|
||||
|
||||
// Convenience function for initially communicating config to mon thr
|
||||
void setConfig(RclConfig *conf);
|
||||
@ -70,7 +73,7 @@ class RclMonEventQueue {
|
||||
};
|
||||
|
||||
/** Start monitoring on the topdirs described in conf */
|
||||
extern bool startMonitor(RclConfig *conf, bool nofork);
|
||||
extern bool startMonitor(RclConfig *conf, int flags);
|
||||
|
||||
/** Main routine for the event receiving thread */
|
||||
extern void *rclMonRcvRun(void *);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
#ifdef RCL_MONITOR
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: rclmonprc.cpp,v 1.9 2006-12-23 13:07:21 dockes Exp $ (C) 2006 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: rclmonprc.cpp,v 1.10 2006-12-24 07:40:26 dockes Exp $ (C) 2006 J.F.Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -47,6 +47,7 @@ typedef map<string, RclMonEvent> queue_type;
|
||||
*/
|
||||
class RclEQData {
|
||||
public:
|
||||
int m_opts;
|
||||
queue_type m_queue;
|
||||
RclConfig *m_config;
|
||||
bool m_ok;
|
||||
@ -77,6 +78,12 @@ bool RclMonEventQueue::empty()
|
||||
return m_data == 0 ? true : m_data->m_queue.empty();
|
||||
}
|
||||
|
||||
void RclMonEventQueue::setopts(int opts)
|
||||
{
|
||||
if (m_data)
|
||||
m_data->m_opts = opts;
|
||||
}
|
||||
|
||||
// Must be called with the queue locked
|
||||
RclMonEvent RclMonEventQueue::pop()
|
||||
{
|
||||
@ -166,7 +173,7 @@ bool RclMonEventQueue::ok()
|
||||
LOGDEB(("RclMonEventQueue: not ok: bad state\n"));
|
||||
return false;
|
||||
}
|
||||
if (!x11IsAlive()) {
|
||||
if (!(m_data->m_opts & RCLMON_NOX11) && !x11IsAlive()) {
|
||||
LOGDEB(("RclMonEventQueue: not ok: x11\n"));
|
||||
return false;
|
||||
}
|
||||
@ -268,7 +275,7 @@ static void processunlock()
|
||||
|
||||
pthread_t rcv_thrid;
|
||||
|
||||
bool startMonitor(RclConfig *conf, bool nofork)
|
||||
bool startMonitor(RclConfig *conf, int opts)
|
||||
{
|
||||
if (!processlock(conf->getConfDir())) {
|
||||
LOGERR(("startMonitor: lock error. Other process running ?\n"));
|
||||
@ -277,6 +284,7 @@ bool startMonitor(RclConfig *conf, bool nofork)
|
||||
atexit(processunlock);
|
||||
|
||||
rclEQ.setConfig(conf);
|
||||
rclEQ.setopts(opts);
|
||||
if (pthread_create(&rcv_thrid, 0, &rclMonRcvRun, &rclEQ) != 0) {
|
||||
LOGERR(("startMonitor: cant create event-receiving thread\n"));
|
||||
return false;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: recollindex.cpp,v 1.29 2006-12-21 09:22:31 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: recollindex.cpp,v 1.30 2006-12-24 07:40:26 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -217,6 +217,7 @@ static int op_flags;
|
||||
#define OPT_D 0x100
|
||||
#define OPT_e 0x200
|
||||
#define OPT_w 0x400
|
||||
#define OPT_x 0x800
|
||||
|
||||
static const char usage [] =
|
||||
"\n"
|
||||
@ -226,8 +227,10 @@ static const char usage [] =
|
||||
" Index everything according to configuration file\n"
|
||||
" -z : reset database before starting indexation\n"
|
||||
#ifdef RCL_MONITOR
|
||||
"recollindex -m [-D]\n"
|
||||
" Perform real time indexation. Don't become a daemon if -D is set\n"
|
||||
"recollindex -m [-w <secs>] -x [-D]\n"
|
||||
" Perform real time indexation. Don't become a daemon if -D is set.\n"
|
||||
" -w sets number of seconds to wait before starting.\n"
|
||||
" -x disables exit on end of x11 session\n"
|
||||
#endif
|
||||
"recollindex -e <filename [filename ...]>\n"
|
||||
" Purge data for individual files. No stem database updates\n"
|
||||
@ -288,6 +291,7 @@ int main(int argc, const char **argv)
|
||||
Usage();
|
||||
argc--; goto b1;
|
||||
#endif
|
||||
case 'x': op_flags |= OPT_x; break;
|
||||
case 'z': op_flags |= OPT_z; break;
|
||||
default: Usage(); break;
|
||||
}
|
||||
@ -352,7 +356,12 @@ int main(int argc, const char **argv)
|
||||
confindexer = new ConfIndexer(config, &updater);
|
||||
confindexer->index(rezero);
|
||||
delete confindexer;
|
||||
if (startMonitor(config, (op_flags&OPT_D)!=0))
|
||||
int opts = RCLMON_NONE;
|
||||
if (op_flags & OPT_D)
|
||||
opts |= RCLMON_NOFORK;
|
||||
if (op_flags & OPT_x)
|
||||
opts |= RCLMON_NOX11;
|
||||
if (startMonitor(config, opts))
|
||||
exit(0);
|
||||
exit(1);
|
||||
#endif // MONITOR
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user