Index: trunk/Ohana/src/opihi/pantasks/ListenClients.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/ListenClients.c	(revision 16810)
+++ trunk/Ohana/src/opihi/pantasks/ListenClients.c	(revision 16903)
@@ -1,4 +1,4 @@
 # include "pantasks.h"
-# define DEBUG 0
+# define DEBUG 1
 
 static int NCLIENTS;
Index: trunk/Ohana/src/opihi/pantasks/Makefile
===================================================================
--- trunk/Ohana/src/opihi/pantasks/Makefile	(revision 16810)
+++ trunk/Ohana/src/opihi/pantasks/Makefile	(revision 16903)
@@ -23,4 +23,7 @@
 $(SRC)/client_shell.$(ARCH).o \
 $(SRC)/invalid.$(ARCH).o \
+$(SRC)/server_shutdown.$(ARCH).o \
+$(SRC)/server_disconnect.$(ARCH).o \
+$(SRC)/server_connect.$(ARCH).o \
 $(SRC)/init_client.$(ARCH).o
 
Index: trunk/Ohana/src/opihi/pantasks/init_client.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/init_client.c	(revision 16810)
+++ trunk/Ohana/src/opihi/pantasks/init_client.c	(revision 16903)
@@ -1,14 +1,22 @@
 # include "pantasks.h"
 
-int invalid         PROTO((int, char **));
+int invalid           PROTO((int, char **));
+int server_shutdown   PROTO((int, char **));
+int server_disconnect PROTO((int, char **));
+int server_connect    PROTO((int, char **));
 
-/* we list here commands which are not valid for the client, 
-   but represent valid pantasks commands.  these are caught 
-   by the client and sent to the 'invalid' function */
+/* we also list here commands which are not valid for the client, but represent valid
+   pantasks commands.  these are caught by the client and sent to the 'invalid'
+   function */
 
 static Command cmds[] = {  
-  {1, "task",       invalid,  "define a schedulable task"},
-  {1, "task.exit",  invalid,  "define exit macros for a task"},
-  {1, "task.exec",  invalid,  "define pre-exec macro for a task"},
+  {1, "task",       invalid,  	 "define a schedulable task"},
+  {1, "task.exit",  invalid,  	 "define exit macros for a task"},
+  {1, "task.exec",  invalid,  	 "define pre-exec macro for a task"},
+
+  {1, "shutdown",   server_shutdown,   "send exit signal to server"},
+  {1, "disconnect", server_disconnect, "close connection to server"},
+  {1, "connect",    server_connect,    "open connection to server"},
+
 }; 
 
Index: trunk/Ohana/src/opihi/pantasks/init_server.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/init_server.c	(revision 16810)
+++ trunk/Ohana/src/opihi/pantasks/init_server.c	(revision 16903)
@@ -25,4 +25,8 @@
 int ipptool2book    PROTO((int, char **));
 
+int server_run	    PROTO((int, char **));
+int server_stop	    PROTO((int, char **));
+int server_halt	    PROTO((int, char **));
+
 static Command cmds[] = {  
   {1, "active",     task_active,   "set the active state of a task"},
@@ -50,4 +54,8 @@
   {1, "verbose",    verbose,       "set/toggle verbose mode"},
   {1, "version",    version,       "show version information"},
+
+  {1, "run",        server_run,    "run scheduler"},
+  {1, "stop",       server_stop,   "stop scheduler"},
+  {1, "halt",       server_halt,   "halt scheduler"},
 }; 
 
Index: trunk/Ohana/src/opihi/pantasks/server_connect.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/server_connect.c	(revision 16903)
+++ trunk/Ohana/src/opihi/pantasks/server_connect.c	(revision 16903)
@@ -0,0 +1,20 @@
+# include "pantasks.h"
+
+int server_connect (int argc, char **argv) {
+
+  int server;
+
+  if (argc != 1) {
+    gprint (GP_ERR, "USAGE: disconnect\n");
+    return (FALSE);
+  }
+  
+  server = getServer ();
+  if (server) return (TRUE);
+
+  // close connection with server
+  // catch errors (don't exit)
+  multicommand_InitServer ();
+
+  return (TRUE);
+}
Index: trunk/Ohana/src/opihi/pantasks/server_disconnect.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/server_disconnect.c	(revision 16903)
+++ trunk/Ohana/src/opihi/pantasks/server_disconnect.c	(revision 16903)
@@ -0,0 +1,20 @@
+# include "pantasks.h"
+
+int server_disconnect (int argc, char **argv) {
+
+  int server;
+
+  if (argc != 1) {
+    gprint (GP_ERR, "USAGE: disconnect\n");
+    return (FALSE);
+  }
+  
+  server = getServer ();
+  
+  if (!server) return (TRUE);
+
+  // close connection with server
+  multicommand_StopServer ();
+
+  return (TRUE);
+}
Index: trunk/Ohana/src/opihi/pantasks/server_shutdown.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/server_shutdown.c	(revision 16903)
+++ trunk/Ohana/src/opihi/pantasks/server_shutdown.c	(revision 16903)
@@ -0,0 +1,36 @@
+# include "pantasks.h"
+
+int server_shutdown (int argc, char **argv) {
+
+  int status, server;
+  IOBuffer message;
+
+  if (argc != 2) {
+    gprint (GP_ERR, "USAGE: shutdown now\n");
+    return (FALSE);
+  }
+  if (strcmp (argv[1], "now")) {
+    gprint (GP_ERR, "USAGE: shutdown now\n");
+    return (FALSE);
+  }
+  
+  server = getServer ();
+  
+  if (!server) return (TRUE);
+
+  // send the command to the server instead
+  status = SendMessage (server, "exit");
+  fprintf (stderr, "exit status of %d\n", status);
+
+  // try to read from the server until we get a status of 0
+  status = ExpectMessage (server, 2.0, &message);
+  fprintf (stderr, "message status of %d\n", status);
+
+  // XXX I should probably loop until we get an exit status of -3 or EPIPE
+
+  // close connection with server
+  multicommand_StopServer ();
+
+  return (TRUE);
+}
+
