Index: /trunk/Ohana/src/opihi/include/pcontrol.h
===================================================================
--- /trunk/Ohana/src/opihi/include/pcontrol.h	(revision 10692)
+++ /trunk/Ohana/src/opihi/include/pcontrol.h	(revision 10693)
@@ -32,4 +32,12 @@
   PCONTROL_HOST_OFF,
 } HostStat;
+
+typedef enum {
+  PCONTROL_RUN_UNKNOWN,
+  PCONTROL_RUN_NONE,
+  PCONTROL_RUN_HOSTS,
+  PCONTROL_RUN_REAP,
+  PCONTROL_RUN_ALL,
+} RunLevels;
 
 /* stack special positions */
Index: /trunk/Ohana/src/opihi/pcontrol/CheckSystem.c
===================================================================
--- /trunk/Ohana/src/opihi/pcontrol/CheckSystem.c	(revision 10692)
+++ /trunk/Ohana/src/opihi/pcontrol/CheckSystem.c	(revision 10693)
@@ -3,11 +3,15 @@
 
 static struct timeval lastlive = {0, 0};
-static int RunSystem = FALSE;
-
-int SetRunSystem (int state) {
-  int oldstate;
-  oldstate = RunSystem;
-  RunSystem = state;
-  return oldstate;
+static RunLevels RunLevel = PCONTROL_RUN_NONE;
+
+RunLevels SetRunLevel (RunLevels level) {
+  RunLevels oldlevel;
+  oldlevel = RunLevel;
+  RunLevel = level;
+  return oldlevel;
+}
+
+RunLevels GetRunLevel () {
+  return RunLevel;
 }
 
@@ -65,38 +69,47 @@
     TestCheckPoint ();
 
-    // don't run the system checks if RunSystem is FALSE
+    // don't run the system checks if RunLevel is FALSE
     // XXX stop should not suspend all checks: we should continue
     // to harvest completed jobs and migrate idle machines to down
-    if (!RunSystem) {
-      usleep (50000); // idle if RunSystem is FALSE
+    if (RunLevel == PCONTROL_RUN_NONE) {
+      usleep (100000); // idle if we are running nothing
       continue;
     }
-
-    Njobchecks = 0;
-    Nhostchecks = 0;
-
-    // we want to give each block a maximum allowed time
-    Nhostchecks += CheckIdleHosts(0.020); /* submit a new job */
-    TestCheckPoint ();
-
-    Njobchecks  += CheckBusyJobs(0.020);  /* get job status */
-    Njobchecks  += CheckDoneJobs(0.020);  /* harvest job stdout/stderr */
-    Njobchecks  += CheckKillJobs(0.020);  /* harvest job stdout/stderr */
-    TestCheckPoint ();
-
-    Nhostchecks += CheckDoneHosts(0.020); /* reset the host */
-    Nhostchecks += CheckDownHosts(0.100); /* launch the host */
-    TestCheckPoint ();
 
     /* always allow at least one test */
     /* most tests require about 2ms per host.  
        CheckDoneJobs must depend on the size of the output buffer */
+    /* the max delay times are fairly arbitrary and do not impact
+       the user interface.
+     */
+
+    Njobchecks = 0;
+    Nhostchecks = 0;
+
+    if ((RunLevel == PCONTROL_RUN_ALL) || (RunLevel == PCONTROL_RUN_REAP)) {
+      Njobchecks  += CheckBusyJobs(0.020);  /* get job status */
+      Njobchecks  += CheckDoneJobs(0.020);  /* harvest job stdout/stderr */
+      Njobchecks  += CheckKillJobs(0.020);  /* harvest job stdout/stderr */
+      TestCheckPoint ();
+    }
+
+    if (RunLevel != PCONTROL_RUN_NONE) {
+      Nhostchecks += CheckDoneHosts(0.020); /* reset the host */
+      Nhostchecks += CheckDownHosts(0.100); /* launch the host */
+      TestCheckPoint ();
+    }
+
+    if (RunLevel == PCONTROL_RUN_ALL) {
+      // we want to give each block a maximum allowed time
+      Nhostchecks += CheckIdleHosts(0.020); /* submit a new job */
+      TestCheckPoint ();
+    }
 
     // there is nothing on the stacks.  test the hosts and wait a bit
-    if (!Njobchecks && !Nhostchecks) {
+    if (!Njobchecks && !Nhostchecks && (RunLevel != PCONTROL_RUN_NONE)) {
       CheckLiveHosts(0.040);
       usleep (100000); // idle if no jobs are waiting
     } 
-
+    
     if (DEBUG) { 
       Stack *stack;
Index: /trunk/Ohana/src/opihi/pcontrol/Makefile
===================================================================
--- /trunk/Ohana/src/opihi/pcontrol/Makefile	(revision 10692)
+++ /trunk/Ohana/src/opihi/pcontrol/Makefile	(revision 10693)
@@ -50,5 +50,4 @@
 $(SDIR)/kill.$(ARCH).o \
 $(SDIR)/pulse.$(ARCH).o \
-$(SDIR)/stop.$(ARCH).o \
 $(SDIR)/run.$(ARCH).o \
 $(SDIR)/status.$(ARCH).o \
Index: /trunk/Ohana/src/opihi/pcontrol/init.c
===================================================================
--- /trunk/Ohana/src/opihi/pcontrol/init.c	(revision 10692)
+++ /trunk/Ohana/src/opihi/pcontrol/init.c	(revision 10693)
@@ -10,9 +10,8 @@
 int status      PROTO((int, char **));
 int run         PROTO((int, char **));
-int stop        PROTO((int, char **));
 int stderr_pc   PROTO((int, char **));
 int stdout_pc   PROTO((int, char **));
 int verbose     PROTO((int, char **));
-int version         PROTO((int, char **));
+int version     PROTO((int, char **));
 
 // pulse is only available in the un-threaded version
@@ -23,6 +22,6 @@
   {"hoststack", hoststack, "list hosts for a single stack"},
   {"status",    status,    "get system status"},
-  {"stop",      stop,      "stop controller processing"},
-  {"run",       run,       "start controller processing"},
+  {"stop",      run,       "stop controller processing"},
+  {"run",       run,       "set controller runlevel"},
   {"verbose",   verbose,   "set the verbose mode for job"},
   {"version",   version,   "show version information"},
Index: /trunk/Ohana/src/opihi/pcontrol/pcontrol.c
===================================================================
--- /trunk/Ohana/src/opihi/pcontrol/pcontrol.c	(revision 10692)
+++ /trunk/Ohana/src/opihi/pcontrol/pcontrol.c	(revision 10693)
@@ -31,5 +31,5 @@
   rl_attempted_completion_function = command_completer;
 # ifdef THREADED
-  SetRunSystem (TRUE);
+  SetRunLevel (PCONTROL_RUN_ALL);
   pthread_create (&clientsThread, NULL, &CheckSystem_Threaded, NULL);
   rl_event_hook = NULL;
Index: /trunk/Ohana/src/opihi/pcontrol/run.c
===================================================================
--- /trunk/Ohana/src/opihi/pcontrol/run.c	(revision 10692)
+++ /trunk/Ohana/src/opihi/pcontrol/run.c	(revision 10693)
@@ -3,13 +3,54 @@
 int run (int argc, char **argv) {
 
-  if (argc != 1) {
-    gprint (GP_ERR, "USAGE: run\n");
+  RunLevels level;
+
+  if ((argc > 2) ||
+      get_argument (argc, argv, "help") ||
+      get_argument (argc, argv, "-h") ||
+      get_argument (argc, argv, "--help")) 
+  {
+    if (!strcmp (argv[0], "run")) {
+      gprint (GP_ERR, "USAGE: run [level]\n");
+      gprint (GP_ERR, "  allowed levels:\n");
+      gprint (GP_ERR, "  all (default) : manage machines, spawn jobs, harvest jobs\n");
+      gprint (GP_ERR, "  reap          : manage machines, harvest jobs\n");
+      gprint (GP_ERR, "  hosts         : manage machines, not jobs\n");
+      gprint (GP_ERR, "  none          : all stop\n");
+    } else {
+      gprint (GP_ERR, "USAGE: stop (immediate processing halt)\n");
+    }
+    return (FALSE);
+  }
+
+  level = PCONTROL_RUN_UNKNOWN;
+  if (argc == 1) {
+    if (!strcasecmp (argv[0], "run")) level = PCONTROL_RUN_ALL;
+    if (!strcasecmp (argv[0], "stop")) level = PCONTROL_RUN_NONE;
+  } else {
+    if (!strcasecmp (argv[1], "all")) level = PCONTROL_RUN_ALL;
+    if (!strcasecmp (argv[1], "reap")) level = PCONTROL_RUN_REAP;
+    if (!strcasecmp (argv[1], "host")) level = PCONTROL_RUN_HOSTS;
+    if (!strcasecmp (argv[1], "hosts")) level = PCONTROL_RUN_HOSTS;
+    if (!strcasecmp (argv[1], "none")) level = PCONTROL_RUN_NONE;
+  }
+
+  if (level == PCONTROL_RUN_UNKNOWN) {
+    gprint (GP_ERR, "  unknown run level %s\n", argv[1]);
+    gprint (GP_ERR, "  allowed levels:\n");
+    gprint (GP_ERR, "  all (default) : manage machines, spawn jobs, harvest jobs\n");
+    gprint (GP_ERR, "  reap          : manage machines, harvest jobs\n");
+    gprint (GP_ERR, "  hosts         : manage machines, not jobs\n");
+    gprint (GP_ERR, "  none          : all stop\n");
     return (FALSE);
   }
 
 # ifdef THREADED
-  SetRunSystem (TRUE);
+  SetRunLevel (level);
 # else
-  rl_event_hook = CheckSystem;
+  if (level == PCONTROL_RUN_NONE) {
+    rl_event_hook = NULL;
+  } else {
+    rl_event_hook = CheckSystem;
+  }
 # endif
 
@@ -17,2 +58,9 @@
 }
 
+/* 
+   run levels:
+   all (manage machines, spawn jobs, harvest jobs)
+   reap (manage machines, harvest jobs)
+   hosts (manage machines, not jobs)
+   none (all stop)
+*/
