Index: trunk/Ohana/src/opihi/pcontrol/CheckIdleHost.c
===================================================================
--- trunk/Ohana/src/opihi/pcontrol/CheckIdleHost.c	(revision 8296)
+++ trunk/Ohana/src/opihi/pcontrol/CheckIdleHost.c	(revision 8424)
@@ -8,4 +8,12 @@
   Job *job;
 
+  /* if this host has been marked to be turned off, do that and return */
+  if (host[0].markoff) {
+    host[0].markoff = FALSE;
+    StopHost (host);
+    OffHost (host);
+    return (TRUE);
+  }
+    
   /* search the JOB_PENDING stack for an appropriate job */
   stack = GetJobStack (PCONTROL_JOB_PENDING);
@@ -16,8 +24,5 @@
     job = (Job *) stack[0].object[i];
     if (job[0].mode != PCONTROL_JOB_NEEDHOST) continue;
-    if (job[0].hostname == NULL) {
-      gprint (GP_ERR, "programming error: NEEDHOST hostname missing\n");
-      exit (2);
-    }
+    ASSERT (job[0].hostname != NULL, "NEEDHOST hostname missing");
     if (strcasecmp (job[0].hostname, host[0].hostname)) continue;
 
@@ -29,5 +34,5 @@
     RemoveStackEntry (stack, i);
     UnlockStack (stack);
-    StartJob (job);
+    StartJob (job, host);
     return (TRUE);
   }
@@ -37,8 +42,5 @@
     job = (Job *) stack[0].object[i];
     if (job[0].mode != PCONTROL_JOB_WANTHOST) continue;
-    if (job[0].hostname == NULL) {
-      gprint (GP_ERR, "programming error: WANTHOST hostname missing\n");
-      exit (2);
-    }
+    ASSERT (job[0].hostname != NULL, "WANTHOST hostname missing");
     if (strcasecmp (job[0].hostname, host[0].hostname)) continue;
 
@@ -50,5 +52,5 @@
     RemoveStackEntry (stack, i);
     UnlockStack (stack);
-    StartJob (job);
+    StartJob (job, host);
     return (TRUE);
   }
@@ -66,6 +68,6 @@
     RemoveStackEntry (stack, i);
     UnlockStack (stack);
-    StartJob (job);
-   return (TRUE);
+    StartJob (job, host);
+    return (TRUE);
   }
 
@@ -76,5 +78,5 @@
     job = (Job *) stack[0].object[i];
     if (job[0].mode != PCONTROL_JOB_WANTHOST) continue;
-    // test the job age and skip if too young
+    // XXX test the job age and skip if too young
 
     /* we have found an appropriate job; link it to the host and send to StartJob */
@@ -85,5 +87,5 @@
     RemoveStackEntry (stack, i);
     UnlockStack (stack);
-    StartJob (job);
+    StartJob (job, host);
    return (TRUE);
   }
