Index: /trunk/ippTasks/p0tool.sh
===================================================================
--- /trunk/ippTasks/p0tool.sh	(revision 10672)
+++ /trunk/ippTasks/p0tool.sh	(revision 10673)
@@ -1,2 +1,7 @@
-#!/usr/bin/sh
-p0tool -pendingimfile -simple | head -n 20
+#!/bin/csh -f
+if ($#argv != 1) then
+  echo "USAGE: p0tool.sh (Nselect)"
+  exit 2
+endif
+
+p0tool -pendingimfile -simple | head -n $1
Index: /trunk/ippTasks/pantasks.pro
===================================================================
--- /trunk/ippTasks/pantasks.pro	(revision 10672)
+++ /trunk/ippTasks/pantasks.pro	(revision 10673)
@@ -5,5 +5,5 @@
 $WORKDIR = `ipp_datapath.pl path://ESSENCE/`
 $loadpoll = 1
-$loadexec = 10
+$loadexec = 5
 $runpoll = 0.5
 $runexec = 1
@@ -16,5 +16,5 @@
     controller host add sn4
     controller host add sn5
-    controller host add sn6
+#    controller host add sn6
     # sn7 serves the disk
   end
Index: /trunk/ippTasks/phase0.pro
===================================================================
--- /trunk/ippTasks/phase0.pro	(revision 10672)
+++ /trunk/ippTasks/phase0.pro	(revision 10673)
@@ -15,22 +15,5 @@
 end
 
-macro test.p0
-    list testlist -x "p0tool -pendingimfile -simple"
-    echo $testlist:n
-    for i 0 $testlist:n
-      queuepush stdout "$testlist:$i"
-    end
-    echo Done pushing.
-    queuesize stdout -var Nqueue
-    for i 0 $Nqueue
-      queuepop stdout -var line
-      list word -split $line
-      $EXP_TAG  = $word:0
-      $CLASS    = $word:1
-      $CLASS_ID = $word:2
-      $URI      = $word:3
-      queuepush Phase0Imfiles -uniq -key 1 "NEW $EXP_TAG $CLASS $CLASS_ID $URI"
-    end
-end
+$Phase0ImfileFail = 0
 
 # select images ready for phase0 analysis
@@ -39,13 +22,16 @@
 task	       phase0.imfile.load
 #  command      p0tool -pendingimfile -simple
-  command      /home/price/ipp/ippTasks/p0tool.sh
   host         local
 
   periods      -poll $loadpoll
-  periods      -exec 30
+  periods      -exec $loadexec
   periods      -timeout 30
 
   stdout phase0.imfile.log
   stderr phase0.imfile.log
+
+  task.exec
+    command      p0tool.sh {$Phase0ImfileFail + 20}
+  end
 
   # success
@@ -76,4 +62,5 @@
   task.exit    default
     echo "phase0 pending imfiles: failure"
+    $Phase0ImfileFail ++
   end
 
@@ -138,4 +125,5 @@
     echo "failure for phase0imfile.pl: $options:0"
     queuepush Phase0Imfiles -replace -key 1 "FAIL $options:0"
+    $Phase0ImfileFail ++
   end
 
Index: /trunk/ippTasks/testscript.pro
===================================================================
--- /trunk/ippTasks/testscript.pro	(revision 10673)
+++ /trunk/ippTasks/testscript.pro	(revision 10673)
@@ -0,0 +1,83 @@
+# test for pcontrol
+macro test.pcontrol.simple
+  stop
+  for i 0 100
+   job ls -R /etc
+  end
+
+  status
+  host add sn2
+  host add sn3
+  host add sn4
+  host add sn5
+
+  status
+  run
+end
+
+# test for pcontrol
+macro test.pcontrol
+  exec p0tool -pendingimfile -simple | head -n 100 > list.dat
+
+  stop
+  list line -x "cat list.dat"
+  echo $line:0
+  for i 0 $line:n
+   list word -split $line:$i
+   job phase0_imfile.pl --exp_tag $word:0 --class_id fpa --uri $word:3
+  end
+
+  status
+  host add sn2
+  host add sn3
+  host add sn4
+  host add sn5
+
+  status
+  run
+end
+
+# test for pclient
+macro test.pclient
+  exec p0tool -pendingimfile -simple | head -n 100 > list.dat
+
+  list line -x "cat list.dat"
+  echo $line:0
+  for i 0 $line:n
+   list word -split $line:$i
+   job phase0_imfile.pl --exp_tag $word:0 --class_id fpa --uri $word:3
+
+   for i 0 50
+    check
+    output /dev/null
+    status
+    output stdout
+    if ($JOBSTATUS == EXIT)
+      $i = 50
+      reset
+      echo "DONE"
+    else
+      usleep 200000
+    end
+   end
+   if ($JOBSTATUS != EXIT)
+     echo TIMEOUT***
+   end
+  end
+end
+
+macro simple.test
+  for j 0 100
+   job ls
+   for i 0 50
+    check
+    status
+    if ($JOBSTATUS == EXIT)
+      $i = 50
+      reset
+    else
+      usleep 10000
+    end
+   end
+ end
+end
