Index: branches/eam_branches/20090715/ippTasks/pstamp.pro
===================================================================
--- branches/eam_branches/20090715/ippTasks/pstamp.pro	(revision 25402)
+++ branches/eam_branches/20090715/ippTasks/pstamp.pro	(revision 25625)
@@ -1,4 +1,8 @@
-
-#$VERBOSE = 3
+# pstamp.pro : Postage Stamp Server tasks
+
+check.globals
+
+$LOGSUBDIR = $LOGDIR/pstamp
+mkdir $LOGSUBDIR
 
 # these variables wil cycle through the known database names
@@ -8,4 +12,5 @@
 $pstampJob_DB = 0
 $pstampFin_DB = 0
+$pstampRev_DB = 0
 
 # set PS_DBSERVER if postage stamp database host is not the same as the value for DBSERVER in site.config
@@ -52,5 +57,9 @@
         active true
     end
-end
+    task pstamp.job.revert
+        active true
+    end
+end
+
 
 macro pstamp.off
@@ -75,4 +84,18 @@
     end
     task pstamp.job.run
+        active false
+    end
+    task pstamp.job.revert
+        active false
+    end
+end
+
+macro pstamp.revert.on
+    task pstamp.job.revert
+        active true
+    end
+end
+macro pstamp.revert.off
+    task pstamp.job.revert
         active false
     end
@@ -88,4 +111,6 @@
 
     task.exec
+        stdout $LOGSUBDIR/pstamp.request.find.log
+        stderr $LOGSUBDIR/pstamp.request.find.log
         if ($DB:n == 0)
             option DEFAULT
@@ -125,4 +150,6 @@
 
     task.exec
+        stdout $LOGSUBDIR/pstamp.request.load.log
+        stderr $LOGSUBDIR/pstamp.request.load.log
         $run = pstamptool -pendingreq
         if ($DB:n == 0)
@@ -168,4 +195,6 @@
 
     task.exec
+        stdout $LOGSUBDIR/pstamp.request.run.log
+        stderr $LOGSUBDIR/pstamp.request.run.log
         book npages pstampRequest -var N
         if ($N == 0) break
@@ -223,4 +252,6 @@
 
     task.exec
+        stdout $LOGSUBDIR/pstamp.finish.load.log
+        stderr $LOGSUBDIR/pstamp.finish.load.log
         $run = pstamptool  -completedreq
         if ($DB:n == 0)
@@ -265,4 +296,6 @@
 
     task.exec
+        stdout $LOGSUBDIR/request.finish.run.log
+        stderr $LOGSUBDIR/request.finish.run.log
         book npages pstampFinish -var N
         if ($N == 0) break
@@ -320,4 +353,6 @@
 
     task.exec
+        stdout $LOGSUBDIR/pstamp.job.load.log
+        stderr $LOGSUBDIR/pstamp.job.load.log
         $run = pstamptool -pendingjob
         if ($DB:n == 0)
@@ -346,15 +381,16 @@
     end
 
+    task.exit   crash
+        showcommand crash
+    end
+
+    task.exit   timeout
+        showcommand timeout
+    end
+
     task.exit   default
         showcommand failure
     end
 
-    task.exit   crash
-        showcommand crash
-    end
-
-    task.exit   timeout
-        showcommand timeout
-    end
 end
 
@@ -365,4 +401,6 @@
 
     task.exec
+        stdout $LOGSUBDIR/pstamp.job.run.log
+        stderr $LOGSUBDIR/pstamp.job.run.log
         book npages pstampJob -var N
         if ($N == 0) 
@@ -430,2 +468,44 @@
     end
 end
+
+task pstamp.job.revert
+    host        local
+
+    periods     -poll $LOADPOLL
+    periods     -exec 10
+    periods     -timeout 300
+    npending    1
+
+    task.exec
+        stdout $LOGSUBDIR/pstamp.job.revert.log
+        stderr $LOGSUBDIR/pstamp.job.revert.log
+        $run = pstamptool -revertjob -all
+        if ($DB:n == 0)
+            option DEFAULT
+        else 
+            $run = $run $PS_DBSERVER -dbname $DB:$pstampRev_DB
+            $pstampRev_DB ++
+            if ($pstampRev_DB >= $DB:n) set pstampRev_DB = 0
+        end
+        add_poll_args run
+        # add_poll_labels run
+        command $run
+    end
+
+    task.exit $EXIT_SUCCESS
+        # nothing to do
+    end
+
+    task.exit   default
+        showcommand failure
+    end
+
+    task.exit   crash
+        showcommand crash
+    end
+
+    task.exit   timeout
+        showcommand timeout
+    end
+end
+
