Index: /trunk/Ohana/src/opihi/lib.shell/multicommand_client.c
===================================================================
--- /trunk/Ohana/src/opihi/lib.shell/multicommand_client.c	(revision 7930)
+++ /trunk/Ohana/src/opihi/lib.shell/multicommand_client.c	(revision 7930)
@@ -0,0 +1,48 @@
+# include "opihi.h"
+
+/* take input line and split into multiple lines
+   at the semi-colons.  send these to 'command' */
+
+/* this function should check for a return value of
+   -1 which means invalid command */
+
+int multicommand_client (char *line, int server) {
+ 
+  int done, status;
+  char *p, *q, *tmpline, *outline;
+  IOBuffer message;
+
+  p = line; 
+  done = FALSE;
+  status = TRUE;
+  while (!done) {
+    q = strchr (p, ';');
+    if (q == NULL) {
+      q = p + strlen(p);
+      done = TRUE;
+    }
+    tmpline = strncreate (p, q - p);
+    stripwhite (tmpline);
+    if (*tmpline) {
+      status = command_client (tmpline, &outline);
+      if (status == -1) {
+	// send the command to the server instead
+	SendMessage (server, outline);
+
+	// receive the resulting stderr
+	status = ExpectMessage (server, 2.0, &message);
+	fwrite (message.buffer, 1, message.Nbuffer, stderr);
+
+	// receive the resulting stdout
+	status = ExpectMessage (server, 2.0, &message);
+	fwrite (message.buffer, 1, message.Nbuffer, stderr);
+      }
+      if (outline != NULL) free (outline);
+      if (!status && auto_break) done = TRUE;
+    }
+    p = q + 1;
+  }
+  return (status);
+}
+
+/* should skip ; surrounded by "" */
Index: /trunk/Ohana/src/opihi/pantasks/RunScheduler.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/RunScheduler.c	(revision 7930)
+++ /trunk/Ohana/src/opihi/pantasks/RunScheduler.c	(revision 7930)
@@ -0,0 +1,85 @@
+# include "pantasks.h"
+
+/* the RunScheduler thread should continuously loop over:
+  
+  - tasks
+  - jobs
+
+  occasionally, it should:
+  - check controller state
+  - check for new input files to be loaded
+
+  alternatively, we could have separate threads for each of these
+  tasks and simply have them each grab a mutex before they go:
+
+  CheckTasks:
+  - grab mutex
+  - loop over all tasks
+  - release mutex
+  - nanosleep? 
+  
+  CheckJobs:
+  - grab mutex
+  - loop over all jobs
+  - release mutex
+  - nanosleep?
+
+  CheckController:
+  - grab mutex
+  - check status
+  - check output
+  - release mutex
+  - usleep 10000
+
+  CheckInputs
+  - grab mutex
+  - check for inputs on list
+  - load inputs
+  - release mutex
+  - usleep 200000
+
+  this strategy seems fairly clean, with the somewhat odd design feature
+  that all of these 'body' threads are force to run in serial, not parallel, 
+  by use of the mutexes.  It is somewhat cleaner programming.  The only
+  restriction on the commands allowed to the clients is that they must not
+  be allowed to change any of the pantasks internal state variables (variables,
+  macros, lists, etc).  This is solved by restricting the clients to output
+  message functions only (reporting functions).
+
+*/
+
+# define MAX_DELAY 0.1
+struct timeval start, last;
+static int Ncheck = 0;
+
+int CheckSystem () {
+
+  gettimeofday (&start, (void *) NULL);
+
+  if (Ncheck < 100) {
+    CheckTasks ();
+    CheckJobs ();
+    Ncheck ++;
+  } else {
+    CheckController ();
+    CheckControllerOutput ();
+    Ncheck = 0;
+  }
+  /* ohana_memcheck (FALSE); */
+  return (TRUE);
+}
+
+int TestElapsedCheck () {
+
+  struct timeval stop;
+  float dtime;
+
+  gettimeofday (&stop, (void *) NULL);
+  dtime = DTIME (stop, start);
+  if (dtime > MAX_DELAY) return (TRUE);
+  return (FALSE);
+}
+
+  /* do we really need to check the controller on every call?
+     or perhaps alternate?
+  */
Index: /trunk/Ohana/src/opihi/pantasks/server.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/server.c	(revision 7930)
+++ /trunk/Ohana/src/opihi/pantasks/server.c	(revision 7930)
@@ -0,0 +1,53 @@
+# include "pantasks.h"
+
+/* most of these are defined in cmd.basic */
+int quit            PROTO((int, char **));
+int input      	    PROTO((int, char **));
+int cd              PROTO((int, char **));
+int pwd        	    PROTO((int, char **));
+int output     	    PROTO((int, char **));
+
+CommandF *FindServerCommand (char *cmd);
+
+static Command server_cmds[] = {
+  {"exit",   quit,   "shutdown server"},
+  {"quit",   quit,   "shutdown server"},
+  {"input",  input,  "load input file on server"},
+  {"cd",     cd,     "set local directory"},
+  {"pwd",    pwd,    "check local directory"},
+  {"output", output, "set server output destinations"},
+};
+
+int server (int argc, char **argv) {
+
+  int status;
+  CommandF *func;
+
+  if (argc < 2) {
+    gprint (GP_ERR, "USAGE: server (command) ... \n");
+    return (FALSE);
+  }
+
+  func = FindServerCommand (argv[1]);
+  if (func == NULL) {
+    gprint (GP_ERR, "invalid server command\n");
+    return (FALSE);
+  }
+
+  status = (*func)(argc - 1, argv + 1);
+  return (status);
+}
+
+CommandF *FindServerCommand (char *cmd) {
+
+  int i, N;
+
+  N = sizeof (server_cmds) / sizeof (Command);
+
+  for (i = 0; i < N; i++) {
+    if (!strcmp (server_cmds[i].name, cmd)) {
+      return (server_cmds[i].func);
+    }
+  }
+  return (NULL);
+}
