Index: /branches/eam_branches/ipp-20120627/Ohana/src/opihi/dvo/dvo_host_utils.c
===================================================================
--- /branches/eam_branches/ipp-20120627/Ohana/src/opihi/dvo/dvo_host_utils.c	(revision 34118)
+++ /branches/eam_branches/ipp-20120627/Ohana/src/opihi/dvo/dvo_host_utils.c	(revision 34119)
@@ -15,4 +15,23 @@
   snprintf (uniquer, 12, "%05d.%05d", PID, TIME % 100000);
 
+  // write the dvo comment (host independent)
+  char commandBase[DVO_MAX_PATH];
+  snprintf (commandBase, DVO_MAX_PATH, "dvo.command.%s.txt", uniquer);
+  char *commandFile = abspath(commandBase, DVO_MAX_PATH);
+
+  FILE *f = fopen (commandFile, "w");
+  fprintf (f, "%s\n", basecmd);
+  if (fflush (f)) DIE("flush", "failed to flush");
+
+  int fd = fileno (f);
+  if (fsync (fd)) DIE("fsync", "failed to fsync");
+
+  if (fclose (f)) DIE("close", "failed to close");
+
+  // force NFS to write the file to disk
+  int state;
+  f = fsetlockfile (commandFile, 0.5, LCK_XCLD, &state);
+  fclearlockfile (commandFile, f, LCK_XCLD, &state);
+
   int top_status = TRUE;
   int i;
@@ -29,25 +48,6 @@
     snprintf (table->hosts[i].results, DVO_MAX_PATH, "%s/dvo.results.%s.fits", table->hosts[i].pathname, uniquer);
 
-    char commandBase[DVO_MAX_PATH];
-    snprintf (commandBase, DVO_MAX_PATH, "dvo.command.%s.txt", uniquer);
-    char *commandFile = abspath(commandBase, DVO_MAX_PATH);
-
-    FILE *f = fopen (commandFile, "w");
-    fprintf (f, "%s\n", basecmd);
-    if (fflush (f)) DIE("flush", "failed to flush");
-
-    int fd = fileno (f);
-    if (fsync (fd)) DIE("fsync", "failed to fsync");
-
-    if (fclose (f)) DIE("close", "failed to close");
-
-    // force NFS to write the file to disk
-    int state;
-    f = fsetlockfile (commandFile, 0.5, LCK_XCLD, &state);
-    fclearlockfile (commandFile, f, LCK_XCLD, &state);
-
     char command[1024];
     snprintf (command, 1024, "dvo_client %s -result %s %s -hostID %d -hostdir %s", commandFile, table->hosts[i].results, options, table->hosts[i].hostID, table->hosts[i].pathname);
-    free (commandFile);
 
     if (VERBOSE) gprint (GP_ERR, "command: %s\n", command);
@@ -75,4 +75,5 @@
     }
   }
+  free (commandFile);
   return top_status;
 }
Index: /branches/eam_branches/ipp-20120627/Ohana/src/opihi/dvo/hosts.c
===================================================================
--- /branches/eam_branches/ipp-20120627/Ohana/src/opihi/dvo/hosts.c	(revision 34118)
+++ /branches/eam_branches/ipp-20120627/Ohana/src/opihi/dvo/hosts.c	(revision 34119)
@@ -2,4 +2,6 @@
 # include <glob.h>
 # define DVO_MAX_PATH 1024
+
+enum {TEMP_NONE, TEMP_DVO_RESULTS, TEMP_DVO_LOG, TEMP_RELPHOT_RESULTS, TEMP_RELPHOT_LOG};
 
 // functions to manage the remote hosts
@@ -10,4 +12,6 @@
     gprint (GP_ERR, "  commands:\n");
     gprint (GP_ERR, "    purge-temp : delete all tempfiles for this shell\n");
+    gprint (GP_ERR, "               : [-old-pid] [-all-pid] [-v] [-verbose] [-commit] [-type type]\n");
+    gprint (GP_ERR, "    get-results : determine name of RESULTS file\n");
     return FALSE;
   }
@@ -27,5 +31,4 @@
       remove_argument (N, &argc, argv);
       ALL_PID = TRUE;
-      remove_argument (N, &argc, argv);
     }
     
@@ -46,4 +49,25 @@
     }
     
+    // we have the following types of temp files:
+    // dvo.results.*.fits
+    // dvo.results.*.fits.log
+    // log.rlpc.* (relphot logs)
+    // relphot.catalog.subset.dat [no glob needed]
+    int TEMP_TYPE = TEMP_DVO_RESULTS;
+    if ((N = get_argument (argc, argv, "-type"))) {
+      TEMP_TYPE = TEMP_NONE;
+      remove_argument (N, &argc, argv);
+      if (!strcasecmp(argv[N], "dvo.results"))     TEMP_TYPE = TEMP_DVO_RESULTS;
+      if (!strcasecmp(argv[N], "dvo.log"))         TEMP_TYPE = TEMP_DVO_LOG;
+      if (!strcasecmp(argv[N], "relphot.results")) TEMP_TYPE = TEMP_RELPHOT_RESULTS;
+      if (!strcasecmp(argv[N], "relphot.log"))     TEMP_TYPE = TEMP_RELPHOT_LOG;
+      if (TEMP_TYPE == TEMP_NONE) {
+	gprint (GP_ERR, "USAGE: hosts purge-temp [-type (type)]\n");
+	gprint (GP_ERR, "  allowed types dvo.results, dvo.log, relphot.results, relphot.log]\n");
+	return FALSE;
+      }
+      remove_argument (N, &argc, argv);
+    }
+
     // XXX wrap this up in a function:
     char *CATDIR = GetCATDIR();
@@ -63,4 +87,9 @@
     }    
     
+    if (argc != 2) {
+      gprint (GP_ERR, "USAGE: hosts purge-temp [-all-pid] [-old-pid PID] [-verbose] [-commit]\n");
+      return FALSE;
+    }
+
     int i;
     for (i = 0; i < table->Nhosts; i++) {
@@ -68,7 +97,13 @@
       char name[DVO_MAX_PATH];
       if (ALL_PID) {
-	snprintf (name, DVO_MAX_PATH, "%s/dvo.results.*.*.fits", table->hosts[i].pathname);
+	if (TEMP_TYPE == TEMP_DVO_RESULTS)     snprintf (name, DVO_MAX_PATH, "%s/dvo.results.*.fits", table->hosts[i].pathname);
+	if (TEMP_TYPE == TEMP_DVO_LOG)         snprintf (name, DVO_MAX_PATH, "%s/dvo.results.*.fits.log", table->hosts[i].pathname);
+	if (TEMP_TYPE == TEMP_RELPHOT_RESULTS) snprintf (name, DVO_MAX_PATH, "%s/log.rlpc.*", table->hosts[i].pathname);
+	if (TEMP_TYPE == TEMP_RELPHOT_LOG)     snprintf (name, DVO_MAX_PATH, "%s/relphot.catalog.subset.dat", table->hosts[i].pathname);
       } else {
-	snprintf (name, DVO_MAX_PATH, "%s/dvo.results.%05d.*.fits", table->hosts[i].pathname, PID);
+	if (TEMP_TYPE == TEMP_DVO_RESULTS)     snprintf (name, DVO_MAX_PATH, "%s/dvo.results.%05d.*.fits", table->hosts[i].pathname, PID);
+	if (TEMP_TYPE == TEMP_DVO_LOG)         snprintf (name, DVO_MAX_PATH, "%s/dvo.results.%05d.*.fits.log", table->hosts[i].pathname, PID);
+	if (TEMP_TYPE == TEMP_RELPHOT_RESULTS) snprintf (name, DVO_MAX_PATH, "%s/log.rlpc.*", table->hosts[i].pathname);
+	if (TEMP_TYPE == TEMP_RELPHOT_LOG)     snprintf (name, DVO_MAX_PATH, "%s/relphot.catalog.subset.dat", table->hosts[i].pathname);
       }
       if (VERBOSE) gprint (GP_ERR, "checking %s\n", name);
@@ -108,6 +143,4 @@
   }
 
-  
-
   gprint (GP_ERR, "error: unknown hosts command %s\n", argv[1]);
   return FALSE;
