Index: trunk/ippTasks/nightly_stacks.pro
===================================================================
--- trunk/ippTasks/nightly_stacks.pro	(revision 28887)
+++ trunk/ippTasks/nightly_stacks.pro	(revision 28982)
@@ -88,4 +88,7 @@
     active true
   end
+  task ns.stacks.confirm
+    active true
+  end
 end
 
@@ -155,4 +158,5 @@
 $ns_stackPAGE = 0
 $ns_RstackPAGE = 0
+$ns_CstackPAGE = 0
 
 book init nsData
@@ -431,4 +435,11 @@
     end
 
+    book getword nsData $options:0 nsNmacros -var ns_Nmacros
+    for i 0 $ns_Nmacros
+	sprintf macroName "ns%dMacro" $i
+	book getword nsData $options:0 $macroName -var macroCmd
+	$macroCmd
+    end
+
     if ($VERBOSE > 2)
 	book listbook nsData
@@ -486,4 +497,11 @@
     ipptool2book stdout nsData -uniq -key date
 
+    book getword nsData $options:0 nsNmacros -var ns_Nmacros
+    for i 0 $ns_Nmacros
+	sprintf macroName "ns%dMacro" $i
+	book getword nsData $options:0 $macroName -var macroCmd
+	$macroCmd
+    end
+
     if ($VERBOSE > 2)
 	book listbook nsData
@@ -541,4 +559,11 @@
     ipptool2book stdout nsData -uniq -key date
 
+    book getword nsData $options:0 nsNmacros -var ns_Nmacros
+    for i 0 $ns_Nmacros
+	sprintf macroName "ns%dMacro" $i
+	book getword nsData $options:0 $macroName -var macroCmd
+	$macroCmd
+    end
+
     if ($VERBOSE > 2)
 	book listbook nsData
@@ -562,4 +587,5 @@
 # Check to see if the warps are finished and so we can make stacks.
 #
+
 task              ns.stacks.run
   host            local
@@ -595,4 +621,73 @@
 # We've queued up stacking. We're done with this date, so don't reload the page.
     ipptool2book stdout nsData -uniq -key date
+
+    book getword nsData $options:0 nsNmacros -var ns_Nmacros
+    for i 0 $ns_Nmacros
+	sprintf macroName "ns%dMacro" $i
+	book getword nsData $options:0 $macroName -var macroCmd
+	$macroCmd
+    end
+
+    if ($VERBOSE > 2)
+	book listbook nsData
+    end
+  end
+
+  # locked list
+  task.exit    default
+    showcommand failure
+  end
+  task.exit    crash
+    showcommand crash
+  end
+  #operation times out?
+  task.exit    timeout
+    showcommand timeout
+  end
+end
+
+#
+# Confirm that all the stacks that can be built have been built, or at least attempted.
+#
+task              ns.stacks.confirm
+  host            local
+  periods         -poll $LOADPOLL
+  periods         -exec $LOADEXEC
+  periods         -timeout 120
+  npending        1
+
+  task.exec
+     stdout NULL
+     stderr $LOGDIR/ns.stacks.log
+
+     book getpage nsData $ns_CstackPAGE -var date
+     book getword nsData $date nsState -var ns_STATE
+     book npages nsData -var Npages
+
+     if ($VERBOSE > 5)
+	echo "ns.stacks.confirm: " $ns_CstackPAGE $date $ns_STATE $Npages
+     end
+
+     $ns_CstackPAGE ++
+     if ($ns_CstackPAGE >= $Npages) set ns_CstackPAGE = 0
+     option $date
+
+     if ("$ns_STATE" != "STACKING") break
+     $run = automate_stacks.pl --confirm_stacks --date $date
+     command $run
+   end
+  # success
+  task.exit   0
+#    convert 'stdout' to book format
+    book delpage nsData $options:0
+    ipptool2book stdout nsData -uniq -key date
+
+    book getword nsData $options:0 nsNmacros -var ns_Nmacros
+    for i 0 $ns_Nmacros
+	sprintf macroName "ns%dMacro" $i
+	book getword nsData $options:0 $macroName -var macroCmd
+	$macroCmd
+    end
+
     if ($VERBOSE > 2)
 	book listbook nsData
@@ -650,4 +745,11 @@
     ipptool2book stdout nsBurntool -uniq -key date
     book setword nsData $options:0 nsState "QUEUEBURNING"
+
+    book getword nsData $options:0 nsNmacros -var ns_Nmacros
+    for i 0 $ns_Nmacros
+	sprintf macroName "ns%dMacro" $i
+	book getword nsData $options:0 $macroName -var macroCmd
+	$macroCmd
+    end
 
     if ($VERBOSE > 2)
@@ -766,4 +868,12 @@
     # Set the job state for success.
     book setword nsBurntool $options:0 $options:2 FINISHED
+
+    book getword nsData $options:0 nsNmacros -var ns_Nmacros
+    for i 0 $ns_Nmacros
+	sprintf macroName "ns%dMacro" $i
+	book getword nsData $options:0 $macroName -var macroCmd
+	$macroCmd
+    end
+
     if ($VERBOSE > 2)
 	book listbook nsData
