Index: trunk/Ohana/src/opihi/pantasks/ControllerOps.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/ControllerOps.c	(revision 4539)
+++ trunk/Ohana/src/opihi/pantasks/ControllerOps.c	(revision 4552)
@@ -3,6 +3,10 @@
 # define CONNECT_TIMEOUT 300
 
-int status = FALSE;
-int stdin_cntl, stdout_cntl, stderr_cntl;
+static int status = FALSE;
+static int stdin_cntl, stdout_cntl, stderr_cntl;
+
+int CheckControllerStatus () {
+  return (status);
+}
 
 int CheckControllerJob (Job *job) {
Index: trunk/Ohana/src/opihi/pantasks/Makefile
===================================================================
--- trunk/Ohana/src/opihi/pantasks/Makefile	(revision 4539)
+++ trunk/Ohana/src/opihi/pantasks/Makefile	(revision 4552)
@@ -26,4 +26,6 @@
 
 funcs = \
+$(SDIR)/init.$(ARCH).o \
+$(SDIR)/scheduler.$(ARCH).o \
 $(SDIR)/CheckJobs.$(ARCH).o \
 $(SDIR)/CheckSystem.$(ARCH).o \
@@ -34,11 +36,16 @@
 $(SDIR)/TaskOps.$(ARCH).o \
 $(SDIR)/IOBufferOps.$(ARCH).o \
-$(SDIR)/memstr.$(ARCH).o \
-$(SDIR)/init.$(ARCH).o
+$(SDIR)/memstr.$(ARCH).o
 
 cmds = \
+$(SDIR)/run.$(ARCH).o \
+$(SDIR)/stop.$(ARCH).o \
+$(SDIR)/status.$(ARCH).o \
+$(SDIR)/kill.$(ARCH).o \
+$(SDIR)/delete.$(ARCH).o \
 $(SDIR)/controller.$(ARCH).o \
-$(SDIR)/run.$(ARCH).o \
-$(SDIR)/scheduler.$(ARCH).o \
+$(SDIR)/controller_host.$(ARCH).o \
+$(SDIR)/controller_check.$(ARCH).o \
+$(SDIR)/controller_status.$(ARCH).o \
 $(SDIR)/task.$(ARCH).o \
 $(SDIR)/task_command.$(ARCH).o \
Index: trunk/Ohana/src/opihi/pantasks/controller.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/controller.c	(revision 4539)
+++ trunk/Ohana/src/opihi/pantasks/controller.c	(revision 4552)
@@ -1,3 +1,7 @@
 # include "scheduler.h"
+
+int controller_host    PROTO((int, char **));
+int controller_status  PROTO((int, char **));
+int controller_check   PROTO((int, char **));
 
 static Command controller_cmds[] = {
@@ -34,5 +38,5 @@
 
   for (i = 0; i < N; i++) {
-    if (!strcmp (controller_cmds[i].name, argv[1])) {
+    if (!strcmp (controller_cmds[i].name, cmd)) {
       return (controller_cmds[i].func);
     }
Index: trunk/Ohana/src/opihi/pantasks/controller_check.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/controller_check.c	(revision 4539)
+++ trunk/Ohana/src/opihi/pantasks/controller_check.c	(revision 4552)
@@ -1,5 +1,5 @@
 # include "scheduler.h"
 
-int controller_host (int argc, char **argv) {
+int controller_check (int argc, char **argv) {
 
   int status;
@@ -7,13 +7,16 @@
   IOBuffer buffer;
 
-  if (argc != 3) {
-    fprintf (stderr, "USAGE: controller host (hostname)\n");
-    return (FALSE);
+  if (argc != 3) goto usage;
+  if (strcasecmp (argv[2], "JOB") && 
+      strcasecmp (argv[2], "HOST")) goto usage;
+
+  /* check if controller is running */
+  status = CheckControllerStatus ();
+  if (!status) {
+    fprintf (stderr, "controller is not running\n");
+    return (TRUE);
   }
 
-  /* start controller connection (if needed) */
-  StartController ();
-
-  sprintf (command, "host %s", argv[2]);
+  sprintf (command, "check %s %s", argv[2], argv[3]);
   InitIOBuffer (&buffer, 0x100);
   status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer);
@@ -32,4 +35,5 @@
     case CONTROLLER_GOOD:
       fprintf (stderr, "controller command sent\n");  
+      fwrite (buffer.buffer, 1, buffer.Nbuffer, stderr);
       return (TRUE);
 
@@ -41,3 +45,8 @@
   fprintf (stderr, "programming error: should not reach here\n");  
   exit (1);
+
+usage:
+  fprintf (stderr, "USAGE: controller check job (jobID)\n");
+  fprintf (stderr, "USAGE: controller check host (hostID)\n");
+  return (FALSE);
 }
Index: trunk/Ohana/src/opihi/pantasks/controller_status.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/controller_status.c	(revision 4539)
+++ trunk/Ohana/src/opihi/pantasks/controller_status.c	(revision 4552)
@@ -1,5 +1,5 @@
 # include "scheduler.h"
 
-int controller_host (int argc, char **argv) {
+int controller_status (int argc, char **argv) {
 
   int status;
@@ -8,12 +8,16 @@
 
   if (argc != 3) {
-    fprintf (stderr, "USAGE: controller host (hostname)\n");
+    fprintf (stderr, "USAGE: controller status\n");
     return (FALSE);
   }
 
-  /* start controller connection (if needed) */
-  StartController ();
+  /* check if controller is running */
+  status = CheckControllerStatus ();
+  if (!status) {
+    fprintf (stderr, "controller is not running\n");
+    return (TRUE);
+  }
 
-  sprintf (command, "host %s", argv[2]);
+  sprintf (command, "status");
   InitIOBuffer (&buffer, 0x100);
   status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer);
@@ -32,4 +36,5 @@
     case CONTROLLER_GOOD:
       fprintf (stderr, "controller command sent\n");  
+      fwrite (buffer.buffer, 1, buffer.Nbuffer, stderr);
       return (TRUE);
 
Index: trunk/Ohana/src/opihi/pantasks/delete.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/delete.c	(revision 4539)
+++ trunk/Ohana/src/opihi/pantasks/delete.c	(revision 4552)
@@ -1,5 +1,5 @@
-# include "pcontrol.h"
+# include "scheduler.h"
 
-int delete (int argc, char **argv) {
+int delete_job (int argc, char **argv) {
 
   Job *job;
@@ -13,28 +13,5 @@
   /* use a string interp to convert JobIDs to ints ? */
 
-  job = PullJob (JobID, PCONTROL_JOB_PENDING);
-  if (job != NULL) goto found;
-
-  job = PullJob (JobID, PCONTROL_JOB_CRASH);
-  if (job != NULL) goto found;
-
-  job = PullJob (JobID, PCONTROL_JOB_EXIT);
-  if (job != NULL) goto found;
-
-  fprintf (stderr, "job %s not PENDING, CRASH, EXIT\n", argv[1]);
-  return (FALSE);
-  
-found:
-  {
-    int j;
-    fprintf (stderr, "deleting job  %s  %d  ", job[0].hostname, job[0].argc);
-    for (j = 0; j < job[0].argc; j++) {
-      fprintf (stderr, "%s ", job[0].argv[j]);
-    }
-    PrintID (stderr, job[0].JobID);
-    fprintf (stderr, "\n");
-  }  
-  DelJob (job);
-
+  fprintf (stderr, "this function is not yet implemented\n");
   return (TRUE);
 }
Index: trunk/Ohana/src/opihi/pantasks/init.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/init.c	(revision 4539)
+++ trunk/Ohana/src/opihi/pantasks/init.c	(revision 4552)
@@ -1,3 +1,2 @@
-# include "basic.h"
 # include "scheduler.h"
 
@@ -10,4 +9,7 @@
 int run             PROTO((int, char **));
 int stop            PROTO((int, char **));
+int status_sys      PROTO((int, char **));
+int kill_job        PROTO((int, char **));
+int delete_job      PROTO((int, char **));
 
 static Command cmds[] = {  
@@ -21,14 +23,21 @@
   {"run",        run,          "run the scheduler"},
   {"stop",       stop,         "stop the scheduler"},
+  {"status",     status_sys,   "get system status"},
+  {"kill",       kill_job,     "kill job"},
+  {"delete",     delete_job,   "delete job"},
+}; 
 
+/* these are functions which duplicate actions on the 
+   controller.  these could simply pass the command along 
+   to the controller (and should then be in 'controller'),
+   or they could add / modify the jobs in the scheduler
+   job stack 
+
+  {"job",        job,          "add job"},
   {"kill",       kill_sh,      "kill job"},
   {"delete",     delete,       "delete job"},
-  {"job",        job,          "add job"},
-  {"host",       host,         "add / delete / modify host"},
-  {"check",      check,        "get job or host status"},
-  {"status",     status,       "get system status"},
-  {"stdout",     stdout_pc,    "get stdout buffer for job"},
-  {"stderr",     stderr_pc,    "get stderr buffer for job"},
-}; 
+  {"stdout",     stdout_sh,    "get stdout buffer for job"},
+  {"stderr",     stderr_sh,    "get stderr buffer for job"},
+*/
 
 void InitSched () {
Index: trunk/Ohana/src/opihi/pantasks/job.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/job.c	(revision 4539)
+++ trunk/Ohana/src/opihi/pantasks/job.c	(revision 4552)
@@ -1,3 +1,19 @@
-# include "pcontrol.h"
+# include "scheduler.h"
+
+/* this will require a bit of care: to define a job, we need
+   to specify:
+   - the command 
+     this is defined in the job command: job argv0 argv1 argv2...
+   - timeout (an option to the command)
+   - exit macros?
+     do nothing by default?
+   - stderr / stdout disposal?
+     save in a specific buffer by default?
+     send to a file?
+
+   the command can look just like the controller equivalent one:
+   job [-host host] [-timeout timeout] args...
+
+*/
 
 int job (int argc, char **argv) {
Index: trunk/Ohana/src/opihi/pantasks/kill.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/kill.c	(revision 4539)
+++ trunk/Ohana/src/opihi/pantasks/kill.c	(revision 4552)
@@ -1,5 +1,5 @@
-# include "pcontrol.h"
+# include "scheduler.h"
 
-int kill_pc (int argc, char **argv) {
+int kill_job (int argc, char **argv) {
 
   Job *job;
@@ -12,12 +12,7 @@
   JobID = atoi (argv[1]);
 
-  job = PullJob (JobID, PCONTROL_JOB_BUSY);
-  if (job == NULL) {
-    fprintf (stderr, "job %s not BUSY\n", argv[1]);
-    return (FALSE);
-  }
-  KillJob (job);
+  /* not yet implemented */
+
+  fprintf (stderr, "this function is not yet implemented\n");
   return (TRUE);
 }
-
-/* find job from jobID, kill locally or on controller */
Index: trunk/Ohana/src/opihi/pantasks/run.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/run.c	(revision 4539)
+++ trunk/Ohana/src/opihi/pantasks/run.c	(revision 4552)
@@ -14,15 +14,2 @@
   return (TRUE);
 }
-
-int stop (int argc, char **argv) {
-
-  if (argc != 1) {
-    fprintf (stderr, "USAGE: stop\n");
-    return (FALSE);
-  }
-
-  rl_event_hook = NULL;
-  rl_set_keyboard_input_timeout (1000000); 
-
-  return (TRUE);
-}
Index: trunk/Ohana/src/opihi/pantasks/status.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/status.c	(revision 4552)
+++ trunk/Ohana/src/opihi/pantasks/status.c	(revision 4552)
@@ -0,0 +1,9 @@
+# include "scheduler.h"
+
+int status_sys (int argc, char **argv) {
+
+  ListTasks ();
+  ListJobs ();
+
+}
+
Index: trunk/Ohana/src/opihi/pantasks/stop.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/stop.c	(revision 4552)
+++ trunk/Ohana/src/opihi/pantasks/stop.c	(revision 4552)
@@ -0,0 +1,14 @@
+# include "scheduler.h"
+
+int stop (int argc, char **argv) {
+
+  if (argc != 1) {
+    fprintf (stderr, "USAGE: stop\n");
+    return (FALSE);
+  }
+
+  rl_event_hook = NULL;
+  rl_set_keyboard_input_timeout (1000000); 
+
+  return (TRUE);
+}
