static volatile sig_atomic_t got_sighup, got_sigchld;
static int timeRunning, virtualTime, clockTime;
static long GMToff;
+static int DisableInotify = 0;
#if defined WITH_INOTIFY
static void handle_signals(cron_db * database) {
if (got_sighup) {
got_sighup = 0;
+ if (DisableInotify)
#if defined WITH_INOTIFY
/* watches must be reinstated on reload */
if (inotify_enabled) {
static void usage(void) {
const char **dflags;
- fprintf(stderr, "usage: %s [-n] [-p] [-m <mail command>] [-x [",
+ fprintf(stderr, "usage: %s [-n] [-p] [-i] [-m <mail command>] [-x [",
ProgramName);
for (dflags = DebugFlagNames; *dflags; dflags++)
fprintf(stderr, "%s%s", *dflags, dflags[1] ? "," : "]");
(void) close(fd);
}
log_it("CRON", getpid(), "STARTUP", PACKAGE_VERSION, 0);
+ if (DisableInotify)
+ log_it("CRON", getpid(), "Switch off inotify - daemon runs with -i option",
+ "", 0);
break;
default:
/* parent process should just die */
load_database(&database);
+
+ if (DisableInotify)
#if defined WITH_INOTIFY
for (i = 0; i < sizeof (wd) / sizeof (wd[0]); ++i) {
/* initialize to negative number other than -1
* clock. Classify the change into one of 4 cases.
*/
timeDiff = timeRunning - virtualTime;
+ if (DisableInotify)
#if defined WITH_INOTIFY
if (inotify_enabled) {
check_inotify_database(&database);
handle_signals(&database);
}
+ if (DisableInotify)
#if defined WITH_INOTIFY
if (inotify_enabled)
set_cron_unwatched(fd);
static void parse_args(int argc, char *argv[]) {
int argch;
- while (-1 != (argch = getopt(argc, argv, "npx:m:"))) {
+ while (-1 != (argch = getopt(argc, argv, "npix:m:"))) {
switch (argch) {
default:
usage();
case 'p':
PermitAnyCrontab = 1;
break;
+ case 'i':
+ inotify_enabled = 0;
+ DisableInotify = 1;
+ break;
case 'm':
strncpy(MailCmd, optarg, MAX_COMMAND);
break;