Index: /trunk/Ohana/src/opihi/include/pantasks.h
===================================================================
--- /trunk/Ohana/src/opihi/include/pantasks.h	(revision 10693)
+++ /trunk/Ohana/src/opihi/include/pantasks.h	(revision 10694)
@@ -33,4 +33,5 @@
       TASK_COMMENT, 
       TASK_NMAX, 
+      TASK_ACTIVE, 
       TASK_TRANGE, 
       TASK_END, 
@@ -94,4 +95,6 @@
   int Nfailure;
   int Ntimeout;
+
+  int active;
 
 } Task;
Index: /trunk/Ohana/src/opihi/pantasks/CheckTasks.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/CheckTasks.c	(revision 10693)
+++ /trunk/Ohana/src/opihi/pantasks/CheckTasks.c	(revision 10694)
@@ -9,4 +9,6 @@
   /** test all tasks: ready to test? ready to run? **/
   while ((task = NextTask ()) != NULL) {
+
+    if (!task[0].active) continue;
 
     /* ready to test? : check exec period */
Index: /trunk/Ohana/src/opihi/pantasks/Makefile
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/Makefile	(revision 10693)
+++ /trunk/Ohana/src/opihi/pantasks/Makefile	(revision 10694)
@@ -50,4 +50,5 @@
 $(SDIR)/task_host.$(ARCH).o \
 $(SDIR)/task_nmax.$(ARCH).o \
+$(SDIR)/task_active.$(ARCH).o \
 $(SDIR)/task_macros.$(ARCH).o \
 $(SDIR)/task_trange.$(ARCH).o \
Index: /trunk/Ohana/src/opihi/pantasks/TaskOps.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/TaskOps.c	(revision 10693)
+++ /trunk/Ohana/src/opihi/pantasks/TaskOps.c	(revision 10694)
@@ -310,4 +310,6 @@
   NewTask[0].Nfailure = 0;
   NewTask[0].Ntimeout = 0;
+
+  NewTask[0].active = TRUE;
   return (NewTask);
 }
@@ -419,4 +421,5 @@
   if (!strcasecmp (command, "HOST"))      hash = TASK_HOST;
   if (!strcasecmp (command, "NMAX"))      hash = TASK_NMAX;
+  if (!strcasecmp (command, "ACTIVE"))    hash = TASK_ACTIVE;
   if (!strcasecmp (command, "TRANGE"))    hash = TASK_TRANGE;
   if (!strcasecmp (command, "STDOUT"))    hash = TASK_STDOUT;
Index: /trunk/Ohana/src/opihi/pantasks/controller.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/controller.c	(revision 10693)
+++ /trunk/Ohana/src/opihi/pantasks/controller.c	(revision 10694)
@@ -14,6 +14,6 @@
   {"host",   controller_host,   "define host for controller"},
   {"check",  controller_check,  "check controller host/job"},
-  {"run",    controller_run,    "start controller operation"},
-  {"stop",   controller_stop,   "stop controller (no disconnect)"},
+  {"run",    controller_run,    "start controller operation / set run levels"},
+  {"stop",   controller_run,    "stop controller (no disconnect)"},
   {"status", controller_status, "check controller status"},
   {"output", controller_output, "print controller output"},
Index: /trunk/Ohana/src/opihi/pantasks/controller_run.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/controller_run.c	(revision 10693)
+++ /trunk/Ohana/src/opihi/pantasks/controller_run.c	(revision 10694)
@@ -7,6 +7,19 @@
   IOBuffer buffer;
 
-  if (argc != 1) {
-    gprint (GP_ERR, "USAGE: controller run\n");
+  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: controller 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: controller stop (immediate processing halt)\n");
+    }
     return (FALSE);
   }
@@ -19,5 +32,10 @@
   }
 
-  sprintf (command, "run");
+  if (argc == 1) {
+    strcpy (command, argv[0]);
+  } else {
+    sprintf (command, "run %s", argv[1]);
+  }
+
   InitIOBuffer (&buffer, 0x100);
   status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer);
@@ -30,32 +48,2 @@
   return (TRUE);
 }
-
-int controller_stop (int argc, char **argv) {
-
-  int status;
-  char command[1024];
-  IOBuffer buffer;
-
-  if (argc != 1) {
-    gprint (GP_ERR, "USAGE: controller stop\n");
-    return (FALSE);
-  }
-
-  /* check if controller is running */
-  status = CheckControllerStatus ();
-  if (!status) {
-    gprint (GP_LOG, "controller is not active\n");
-    return (TRUE);
-  }
-
-  sprintf (command, "stop");
-  InitIOBuffer (&buffer, 0x100);
-  status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer);
-  if (status) {
-    gwrite (buffer.buffer, 1, buffer.Nbuffer, GP_LOG);
-  } else {
-    gprint (GP_LOG, "controller is not responding\n");
-  }
-  FreeIOBuffer (&buffer);
-  return (TRUE);
-}
Index: /trunk/Ohana/src/opihi/pantasks/init.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/init.c	(revision 10693)
+++ /trunk/Ohana/src/opihi/pantasks/init.c	(revision 10694)
@@ -5,4 +5,5 @@
 int task_host	    PROTO((int, char **));
 int task_nmax	    PROTO((int, char **));
+int task_active	    PROTO((int, char **));
 int task_trange	    PROTO((int, char **));
 int task_macros	    PROTO((int, char **));
@@ -26,4 +27,5 @@
   {"host",       task_host,    "define host machine for a task"},
   {"nmax",       task_nmax,    "define maximum number of jobs for a task"},
+  {"active",     task_active,  "define maximum number of jobs for a task"},
   {"trange",     task_trange,  "define valid/invalid time periods for a task"},
   {"task.exit",  task_macros,  "define exit macros for a task"},
Index: /trunk/Ohana/src/opihi/pantasks/task.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/task.c	(revision 10693)
+++ /trunk/Ohana/src/opihi/pantasks/task.c	(revision 10694)
@@ -96,4 +96,5 @@
       case TASK_OPTIONS:
       case TASK_PERIODS:
+      case TASK_ACTIVE:
 	status = command (input, &outline, TRUE);
 	if (outline != NULL) free (outline);
