Commits

millert  committed 760e362

Add quiet option to cause stdout/stderr to be closed. Off by default.

  • Participants
  • Parent commits 749226a
  • Tags 1.1

Comments (0)

Files changed (4)

   { "watchdog-stop-interval", "GIMLI_WATCHDOG_STOP_INTERVAL",
     OPT_INTEGER, &watchdog_stop_interval },
   { "debug", "GIMLI_DEBUG", OPT_INTEGER, &debug },
+  { "quiet", "GIMLI_QUIET", OPT_INTEGER, &quiet },
   { "detach", "GIMLI_DETACH", OPT_INTEGER, &detach },
   { "setsid", "GIMLI_SETSID", OPT_INTEGER, &do_setsid },
   { "glider", "GIMLI_GLIDER_PATH", OPT_STRING, &glider_path },
   struct gimli_object_file *objfile;
 };
 
-extern int debug, detach, watchdog_interval, watchdog_start_interval,
+extern int debug, quiet, detach, watchdog_interval, watchdog_start_interval,
   watchdog_stop_interval, do_setsid, respawn_frequency;
 extern int run_as_uid, run_as_gid;
 extern char *glider_path, *trace_dir, *gimli_progname, *pidfile, *arg0;
 int respawn = 1;
 int should_exit = 0;
 int debug = 0;
+int quiet = 0;
 int watchdog_interval = 60;
 int watchdog_start_interval = 200;
 int watchdog_stop_interval = 60;
 
     if (devnull >= 0) {
       dup2(devnull, STDIN_FILENO);
-      dup2(devnull, STDOUT_FILENO);
-      dup2(devnull, STDERR_FILENO);
+      if (quiet) {
+        dup2(devnull, STDOUT_FILENO);
+        dup2(devnull, STDERR_FILENO);
+      }
       close(devnull);
     }
     chdir("/");

File man/monitor.1

 variable is
 .B GIMLI_DETACH
 .TP
+.B quiet=1
+Enables quiet mode when
+.B detach
+is enabled.  This will redirect the standard output and standard error
+to /dev/null.
+If used without specifying a value, thusly:
+.B --quiet
+the quiet state will be toggled.  The corresponding environmental
+variable is
+.B GIMLI_QUIET
+.TP
 .B setsid=0
 Prevents
 .B monitor