Index: trunk/Ohana/src/opihi/pantasks/LocalJob.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/LocalJob.c	(revision 4602)
+++ trunk/Ohana/src/opihi/pantasks/LocalJob.c	(revision 4684)
@@ -102,4 +102,6 @@
   int result, waitstatus;
 
+  fprintf (stderr, "checking on %d\n", job[0].pid);
+
   /* check local job status */
   result = waitpid (job[0].pid, &waitstatus, WNOHANG);
@@ -135,4 +137,5 @@
 	exit (1);
       }
+      fprintf (stderr, "waited for %d\n", result);
       
       if (WIFEXITED(waitstatus)) {
@@ -151,2 +154,31 @@
   return;
 }
+
+int KillLocalJob (Job *job) {
+
+  int i, result, waitstatus;
+
+  if (job[0].state != JOB_BUSY) return (TRUE);
+
+  /* send SIGTERM signal to job */
+  kill (job[0].pid, SIGTERM);
+  result = 0;
+  for (i = 0; (i < 10) && (result == 0); i++) {
+    usleep (10000);  /* 10 ms is min */
+    result = waitpid (job[0].pid, &waitstatus, WNOHANG);
+  }
+  if (result) return (TRUE);
+
+  /* send SIGKILL signal to job */
+  kill (job[0].pid, SIGKILL);
+  result = 0;
+  for (i = 0; (i < 10) && (result == 0); i++) {
+    usleep (10000);  /* 10 ms is min */
+    result = waitpid (job[0].pid, &waitstatus, WNOHANG);
+  }
+  if (result) return (TRUE);
+
+  /* total failure, don't reset */
+  return (FALSE);
+}
+
