Index: /trunk/Ohana/src/opihi/include/scheduler.h
===================================================================
--- /trunk/Ohana/src/opihi/include/scheduler.h	(revision 4602)
+++ /trunk/Ohana/src/opihi/include/scheduler.h	(revision 4603)
@@ -65,5 +65,5 @@
   TimeRange *ranges;
 
-  int     Ntotal;  // only construct Ntotal jobs for this task
+  int     Nmax;  // only construct Ntotal jobs for this task
   int     Njobs;
 
Index: /trunk/Ohana/src/opihi/pantasks/CheckTasks.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/CheckTasks.c	(revision 4602)
+++ /trunk/Ohana/src/opihi/pantasks/CheckTasks.c	(revision 4603)
@@ -17,4 +17,5 @@
     /* need to check if the current time is within valid/invalid periods */
     if (!CheckTimeRanges (task[0].ranges, task[0].Nranges)) continue;
+    if (task[0].Nmax && (task[0].Njobs >= task[0].Nmax)) continue;
 
     SetCurrentTask (task[0].name);
Index: /trunk/Ohana/src/opihi/pantasks/Makefile
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/Makefile	(revision 4602)
+++ /trunk/Ohana/src/opihi/pantasks/Makefile	(revision 4603)
@@ -52,9 +52,10 @@
 $(SDIR)/controller_output.$(ARCH).o \
 $(SDIR)/task.$(ARCH).o \
-$(SDIR)/task_command.$(ARCH).o \
 $(SDIR)/task_host.$(ARCH).o \
+$(SDIR)/task_nmax.$(ARCH).o \
 $(SDIR)/task_macros.$(ARCH).o \
 $(SDIR)/task_trange.$(ARCH).o \
-$(SDIR)/task_periods.$(ARCH).o
+$(SDIR)/task_periods.$(ARCH).o \
+$(SDIR)/task_command.$(ARCH).o
 
 libs = \
Index: /trunk/Ohana/src/opihi/pantasks/TaskOps.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/TaskOps.c	(revision 4602)
+++ /trunk/Ohana/src/opihi/pantasks/TaskOps.c	(revision 4603)
@@ -138,4 +138,5 @@
   gettimeofday (&tasks[Ntasks].last, (void *) NULL);
   tasks[Ntasks].Njobs = 0;
+  tasks[Ntasks].Nmax = 0;  /* default value means 'no limit' */
 
   Ntasks ++;
Index: /trunk/Ohana/src/opihi/pantasks/init.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/init.c	(revision 4602)
+++ /trunk/Ohana/src/opihi/pantasks/init.c	(revision 4603)
@@ -4,4 +4,5 @@
 int task	    PROTO((int, char **));
 int task_host	    PROTO((int, char **));
+int task_nmax	    PROTO((int, char **));
 int task_trange	    PROTO((int, char **));
 int task_macros	    PROTO((int, char **));
@@ -19,4 +20,5 @@
   {"task",       task,         "define a schedulable task"},
   {"host",       task_host,    "define host machine for a task"},
+  {"nmax",       task_nmax,    "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_nmax.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/task_nmax.c	(revision 4603)
+++ /trunk/Ohana/src/opihi/pantasks/task_nmax.c	(revision 4603)
@@ -0,0 +1,27 @@
+# include "scheduler.h"
+
+int task_nmax (int argc, char **argv) {
+
+  Task *task;
+  char *taskname;
+
+  if (argc != 2) goto usage;
+
+  taskname = GetCurrentTask ();
+  if (taskname == NULL) {
+    fprintf (stderr, "ERROR: not defining or running a task\n");
+    return (FALSE);
+  }
+  task = FindTask (taskname);
+  if (task == NULL) {
+    fprintf (stderr, "ERROR: current task not found??\n");
+    return (FALSE);
+  }
+
+  task[0].Nmax = atoi (argv[1]);
+  return (TRUE);
+
+usage:
+  fprintf (stderr, "USAGE: nmax N\n");
+  return (FALSE);
+}
