Index: /trunk/Ohana/src/opihi/pantasks/CheckPassword.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/CheckPassword.c	(revision 8547)
+++ /trunk/Ohana/src/opihi/pantasks/CheckPassword.c	(revision 8548)
@@ -7,5 +7,5 @@
 
   VarConfig ("PASSWORD", "%s", PASSWORD);
-
+  return (TRUE);
 }
 
Index: /trunk/Ohana/src/opihi/pantasks/ControllerOps.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/ControllerOps.c	(revision 8547)
+++ /trunk/Ohana/src/opihi/pantasks/ControllerOps.c	(revision 8548)
@@ -290,5 +290,5 @@
     status = ReadtoIOBuffer (&buffer, stdout_fd[0]);
     p = memstr (buffer.buffer, "CONNECTED", buffer.Nbuffer);
-    usleep (10000);
+    usleep (10000); // wait for controller to start up
   }
   if (status == 0) goto pipe_error;
@@ -464,5 +464,5 @@
   result = waitpid (ControllerPID, &waitstatus, WNOHANG);
   for (i = 0; (i < 10) && (result == 0); i++) {
-    usleep (10000);  /* 10 ms is min */
+    usleep (10000);  // wait for controller to exit
     result = waitpid (ControllerPID, &waitstatus, WNOHANG);
   }
Index: /trunk/Ohana/src/opihi/pantasks/InputQueue.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/InputQueue.c	(revision 8547)
+++ /trunk/Ohana/src/opihi/pantasks/InputQueue.c	(revision 8548)
@@ -65,12 +65,6 @@
   
   Nbytes = snprintf (&tmp, 0, "input %s", input);
-  fprintf (stderr, "string len %d\n", Nbytes);
-
   ALLOCATE (line, char, Nbytes + 1);
-  fprintf (stderr, "allocated line\n");
-
   snprintf (line, Nbytes + 1, "input %s", input);
-  
-  fprintf (stderr, "running command %s\n", line);
 
   status = command (line, &outline, TRUE);
Index: /trunk/Ohana/src/opihi/pantasks/ListenClients.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/ListenClients.c	(revision 8547)
+++ /trunk/Ohana/src/opihi/pantasks/ListenClients.c	(revision 8548)
@@ -66,5 +66,4 @@
   struct timeval timeout;
   IOBuffer *outbuffer;
-  IOBuffer testbuffer;
 
   InitClients ();
Index: /trunk/Ohana/src/opihi/pantasks/LocalJob.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/LocalJob.c	(revision 8547)
+++ /trunk/Ohana/src/opihi/pantasks/LocalJob.c	(revision 8548)
@@ -166,5 +166,5 @@
   result = 0;
   for (i = 0; (i < 10) && (result == 0); i++) {
-    usleep (10000);  /* 10 ms is min */
+    usleep (10000);  // wait for job to exit
     result = waitpid (job[0].pid, &waitstatus, WNOHANG);
   }
@@ -175,5 +175,5 @@
   result = 0;
   for (i = 0; (i < 10) && (result == 0); i++) {
-    usleep (10000);  /* 10 ms is min */
+    usleep (10000);  // wait for job to exit
     result = waitpid (job[0].pid, &waitstatus, WNOHANG);
   }
Index: /trunk/Ohana/src/opihi/pantasks/Makefile
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/Makefile	(revision 8547)
+++ /trunk/Ohana/src/opihi/pantasks/Makefile	(revision 8548)
@@ -26,10 +26,12 @@
 
 single = \
-$(SDIR)/pantasks.$(ARCH).o
+$(SDIR)/init.$(ARCH).o \
+$(SDIR)/run.$(ARCH).o \
+$(SDIR)/stop.$(ARCH).o \
+$(SDIR)/pantasks.$(ARCH).o \
+$(SDIR)/CheckSystem.$(ARCH).o
 
 funcs = \
-$(SDIR)/init.$(ARCH).o \
 $(SDIR)/CheckJobs.$(ARCH).o \
-$(SDIR)/CheckSystem.$(ARCH).o \
 $(SDIR)/CheckController.$(ARCH).o \
 $(SDIR)/CheckTasks.$(ARCH).o \
@@ -42,6 +44,4 @@
 
 cmds = \
-$(SDIR)/run.$(ARCH).o \
-$(SDIR)/stop.$(ARCH).o \
 $(SDIR)/pulse.$(ARCH).o \
 $(SDIR)/status.$(ARCH).o \
@@ -54,4 +54,5 @@
 $(SDIR)/controller_check.$(ARCH).o \
 $(SDIR)/controller_status.$(ARCH).o \
+$(SDIR)/controller_run.$(ARCH).o \
 $(SDIR)/controller_output.$(ARCH).o \
 $(SDIR)/controller_pulse.$(ARCH).o \
Index: /trunk/Ohana/src/opihi/pantasks/TaskOps.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/TaskOps.c	(revision 8547)
+++ /trunk/Ohana/src/opihi/pantasks/TaskOps.c	(revision 8548)
@@ -128,5 +128,5 @@
 
   int i, j;
-  char *start, *stop
+  char *start, *stop;
   Task *task;
 
Index: /trunk/Ohana/src/opihi/pantasks/client_shell.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/client_shell.c	(revision 8547)
+++ /trunk/Ohana/src/opihi/pantasks/client_shell.c	(revision 8548)
@@ -4,5 +4,5 @@
 int client_shell (int argc, char **argv) {
 
-  int i, Nbad, status, server;
+  int Nbad, status;
   char *line, *prompt, *history;
   pid_t ppid;
Index: /trunk/Ohana/src/opihi/pantasks/controller.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/controller.c	(revision 8547)
+++ /trunk/Ohana/src/opihi/pantasks/controller.c	(revision 8548)
@@ -4,4 +4,6 @@
 int controller_exit    PROTO((int, char **));
 int controller_status  PROTO((int, char **));
+int controller_run     PROTO((int, char **));
+int controller_stop    PROTO((int, char **));
 int controller_check   PROTO((int, char **));
 int controller_output  PROTO((int, char **));
@@ -12,4 +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)"},
   {"status", controller_status, "check controller status"},
   {"output", controller_output, "print controller output"},
@@ -19,5 +23,5 @@
 int controller (int argc, char **argv) {
 
-  int status;
+  int i, N, status;
   CommandF *func;
 
@@ -25,4 +29,13 @@
     gprint (GP_ERR, "USAGE: controller (command) ... \n");
     return (FALSE);
+  }
+
+  if (!strcasecmp (argv[1], "help")) {
+    N = sizeof (controller_cmds) / sizeof (Command);
+
+    for (i = 0; i < N; i++) {
+      gprint (GP_LOG, "%-15s %s\n", controller_cmds[i].name, controller_cmds[i].help);
+    }
+    return (TRUE);
   }
 
Index: /trunk/Ohana/src/opihi/pantasks/controller_host.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/controller_host.c	(revision 8547)
+++ /trunk/Ohana/src/opihi/pantasks/controller_host.c	(revision 8548)
@@ -20,6 +20,11 @@
   sprintf (command, "host %s %s", argv[1], argv[2]);
   InitIOBuffer (&buffer, 0x100);
+
+  SerialThreadLock ();
   status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer);
+  SerialThreadUnlock ();
+
   if (status) gwrite (buffer.buffer, 1, buffer.Nbuffer, GP_LOG);
+
   FreeIOBuffer (&buffer);
   return (TRUE);
Index: /trunk/Ohana/src/opihi/pantasks/controller_run.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/controller_run.c	(revision 8548)
+++ /trunk/Ohana/src/opihi/pantasks/controller_run.c	(revision 8548)
@@ -0,0 +1,61 @@
+# include "pantasks.h"
+
+int controller_run (int argc, char **argv) {
+
+  int status;
+  char command[1024];
+  IOBuffer buffer;
+
+  if (argc != 1) {
+    gprint (GP_ERR, "USAGE: controller run\n");
+    return (FALSE);
+  }
+
+  /* check if controller is running */
+  status = CheckControllerStatus ();
+  if (!status) {
+    gprint (GP_LOG, "controller is not active\n");
+    return (TRUE);
+  }
+
+  sprintf (command, "run");
+  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);
+}
+
+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/controller_status.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/controller_status.c	(revision 8547)
+++ /trunk/Ohana/src/opihi/pantasks/controller_status.c	(revision 8548)
@@ -15,15 +15,20 @@
   status = CheckControllerStatus ();
   if (!status) {
-    gprint (GP_LOG, "controller is not running\n");
+    gprint (GP_LOG, "controller is not active\n");
     return (TRUE);
   }
 
+
   sprintf (command, "status");
   InitIOBuffer (&buffer, 0x100);
+
+  SerialThreadLock ();
   status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer);
+  SerialThreadUnlock ();
+
   if (status) {
     gwrite (buffer.buffer, 1, buffer.Nbuffer, GP_LOG);
   } else {
-    gprint (GP_LOG, "controller is down\n");
+    gprint (GP_LOG, "controller is not communicating\n");
   }
   FreeIOBuffer (&buffer);
Index: /trunk/Ohana/src/opihi/pantasks/init_server.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/init_server.c	(revision 8547)
+++ /trunk/Ohana/src/opihi/pantasks/init_server.c	(revision 8548)
@@ -8,7 +8,6 @@
 int task_macros	    PROTO((int, char **));
 int task_command    PROTO((int, char **));
+int task_options    PROTO((int, char **));
 int task_periods    PROTO((int, char **));
-int run             PROTO((int, char **));
-int stop            PROTO((int, char **));
 int pulse           PROTO((int, char **));
 int status_server   PROTO((int, char **));
@@ -17,25 +16,24 @@
 int verbose         PROTO((int, char **));
 int version         PROTO((int, char **));
-int server         PROTO((int, char **));
+int server          PROTO((int, char **));
 
 static Command cmds[] = {  
-  {"controller", controller,   "controller commands"},
-  {"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"},
-  {"task.exec",  task_macros,  "define pre-exec macro for a task"},
-  {"command",    task_command, "define executed command for a task"},
-  {"periods",    task_periods, "define time scales for a task"},
-  {"run",        run,          "run the scheduler"},
-  {"stop",       stop,         "stop the scheduler"},
-  {"pulse",      pulse,        "set the scheduler update period"},
-  {"server",     server,       "server-specific commands"},
+  {"controller", controller,   	"controller commands"},
+  {"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"},
+  {"task.exec",  task_macros,  	"define pre-exec macro for a task"},
+  {"command",    task_command, 	"define executed command for a task"},
+  {"options",    task_options, "define optional variables associated with the job task"},
+  {"periods",    task_periods, 	"define time scales for a task"},
+  {"pulse",      pulse,        	"set the scheduler update period"},
+  {"server",     server,       	"server-specific commands"},
   {"status",     status_server, "get system status"},
-  {"kill",       kill_job,     "kill job"},
-  {"delete",     delete_job,   "delete job"},
-  {"version",    version,      "show version information"},
-  {"verbose",    verbose,      "set/toggle verbose mode"},
+  {"kill",       kill_job,     	"kill job"},
+  {"delete",     delete_job,   	"delete job"},
+  {"version",    version,      	"show version information"},
+  {"verbose",    verbose,      	"set/toggle verbose mode"},
 }; 
 
Index: /trunk/Ohana/src/opihi/pantasks/pantasks_server.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/pantasks_server.c	(revision 8547)
+++ /trunk/Ohana/src/opihi/pantasks/pantasks_server.c	(revision 8548)
@@ -18,5 +18,5 @@
   pthread_t clientsThread;
   pthread_t tasksThread;
-  pthread_t jobsThread;
+  // pthread_t jobsThread;
   pthread_t inputsThread;
   pthread_t controllerThread;
@@ -48,5 +48,5 @@
   pthread_create (&clientsThread,    NULL, &ListenClients,    	   NULL);
   pthread_create (&tasksThread,      NULL, &CheckTasksThread, 	   NULL);
-  pthread_create (&jobsThread,       NULL, &CheckJobsThread,  	   NULL);
+  // pthread_create (&jobsThread,       NULL, &CheckJobsThread,  	   NULL);
   pthread_create (&controllerThread, NULL, &CheckControllerThread, NULL);
   pthread_create (&inputsThread,     NULL, &CheckInputsThread,     NULL);
Index: /trunk/Ohana/src/opihi/pantasks/server.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/server.c	(revision 8547)
+++ /trunk/Ohana/src/opihi/pantasks/server.c	(revision 8548)
@@ -27,5 +27,5 @@
 int server (int argc, char **argv) {
 
-  int status;
+  int i, N, status;
   CommandF *func;
 
@@ -33,4 +33,13 @@
     gprint (GP_ERR, "USAGE: server (command) ... \n");
     return (FALSE);
+  }
+
+  if (!strcasecmp (argv[1], "help")) {
+    N = sizeof (server_cmds) / sizeof (Command);
+
+    for (i = 0; i < N; i++) {
+      gprint (GP_LOG, "%-15s %s\n", server_cmds[i].name, server_cmds[i].help);
+    }
+    return (TRUE);
   }
 
Index: /trunk/Ohana/src/opihi/pantasks/server_run.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/server_run.c	(revision 8547)
+++ /trunk/Ohana/src/opihi/pantasks/server_run.c	(revision 8548)
@@ -9,4 +9,7 @@
 
   CheckTasksSetState (TRUE);
+  // CheckJobsSetState (TRUE);
+  CheckControllerSetState (TRUE);
+  CheckInputsSetState (TRUE);
   return (TRUE);
 }
@@ -20,4 +23,7 @@
 
   CheckTasksSetState (FALSE);
+  // CheckJobsSetState (FALSE);
+  CheckControllerSetState (FALSE);
+  CheckInputsSetState (FALSE);
   return (TRUE);
 }
Index: /trunk/Ohana/src/opihi/pantasks/server_threads.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/server_threads.c	(revision 8547)
+++ /trunk/Ohana/src/opihi/pantasks/server_threads.c	(revision 8548)
@@ -13,4 +13,13 @@
 }
 
+/* the threaded version of pantasks does not worry about limiting the 
+   time spent in one of the test loops -- comms with the client are
+   in a separate thread anyway...
+*/
+
+int TestElapsedCheck () {
+  return (FALSE);
+}
+
 /** things related to CheckTasks **/
 
@@ -24,5 +33,5 @@
 }
 
-void CheckTasksThread (void *data) {
+void *CheckTasksThread (void *data) {
 
   gprintInit ();  // each thread needs to init the printing system
@@ -31,5 +40,5 @@
     // check for thread suspend
     if (!CheckTasksRun) {
-      usleep (500000);
+      usleep (100000); // idle if thread action is suspended
       continue;
     }
@@ -38,10 +47,15 @@
     SerialThreadLock ();
     CheckTasks ();
+    CheckJobs ();
     SerialThreadUnlock ();
     fprintf (stderr, "T");
-    usleep (250000);
+    usleep (10000); // allow other threads a chance to run
   }
 }
 
+# if 0
+// XXX need to harvest jobs on the same thread as they were
+// spawned.  for the moment, put CheckTasks and CheckJobs in
+// a single thread.
 /** things related to CheckJobs **/
 
@@ -55,5 +69,5 @@
 }
 
-void CheckJobsThread (void *data) {
+void *CheckJobsThread (void *data) {
 
   gprintInit ();  // each thread needs to init the printing system
@@ -62,5 +76,5 @@
     // check for thread suspend
     if (!CheckJobsRun) {
-      usleep (500000);
+      usleep (100000); // idle if thread action is suspended
       continue;
     }
@@ -71,7 +85,8 @@
     SerialThreadUnlock ();
     fprintf (stderr, "J");
-    usleep (250000);
+    usleep (10000); // allow other threads a chance to run
   }
 }
+# endif
 
 /** things related to CheckController **/
@@ -86,5 +101,5 @@
 }
 
-void CheckControllerThread (void *data) {
+void *CheckControllerThread (void *data) {
 
   gprintInit ();  // each thread needs to init the printing system
@@ -93,5 +108,5 @@
     // check for thread suspend
     if (!CheckControllerRun) {
-      usleep (500000);
+      usleep (100000); // idle if thread action is suspended
       continue;
     }
@@ -103,5 +118,5 @@
     SerialThreadUnlock ();
     fprintf (stderr, "C");
-    usleep (250000);
+    usleep (10000); // allow other threads a chance to run
   }
 }
@@ -118,5 +133,5 @@
 }
 
-void CheckInputsThread (void *data) {
+void *CheckInputsThread (void *data) {
 
   gprintInit ();  // each thread needs to init the printing system
@@ -125,5 +140,5 @@
     // check for thread suspend
     if (!CheckInputsRun) {
-      usleep (500000);
+      usleep (100000); // idle if thread action is suspended
       continue;
     }
@@ -134,5 +149,5 @@
     SerialThreadUnlock ();
     fprintf (stderr, "I");
-    usleep (250000);
+    usleep (10000); // allow other threads a chance to run
   }
 }
Index: /trunk/Ohana/src/opihi/pantasks/status_server.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/status_server.c	(revision 8547)
+++ /trunk/Ohana/src/opihi/pantasks/status_server.c	(revision 8548)
@@ -10,7 +10,7 @@
   }
   if (CheckControllerGetState()) {
-    gprint (GP_LOG, " Controller is running\n");
+    gprint (GP_LOG, " Controller is active\n");
   } else {
-    gprint (GP_LOG, " Controller is stopped\n");
+    gprint (GP_LOG, " Controller is not active\n");
   }
   ListTasks (FALSE);
