Index: /tags/ipp-20170121/tools/check_system.sh
===================================================================
--- /tags/ipp-20170121/tools/check_system.sh	(revision 40138)
+++ /tags/ipp-20170121/tools/check_system.sh	(revision 40139)
@@ -262,7 +262,31 @@
 endif
 
+if ("$1" == "restart.block") then
+  touch ~/.restart.block
+  exit 0
+endif
+
+if ("$1" == "restart.clear") then
+  rm -f ~/.restart.block
+  exit 0
+endif
+
+if ("$1" == "restart.check") then
+  if ( -f ~/.restart.block ) then
+    echo "check_system.sh stop.block.restart is currently BLOCKED"
+  else
+    echo "check_system.sh stop.block.restart is currently NOT BLOCKED"
+  endif
+  exit 0
+endif
+
 if ("$1" == "stop.block.restart") then
 
-  # set all controllers to reap first, then block waiting for clear task list:
+  if ( -f ~/.restart.block ) then
+    echo "check_system.sh stop.block.restart is currently BLOCKED"
+    exit 1
+  endif
+
+  # set all pantasks to stop
   foreach dir ($dirs)
     echo "setting $dir to 'reap'"
@@ -270,4 +294,10 @@
   end
 
+  # set all controllers to reap, then block waiting for clear task list:
+  foreach dir ($dirs)
+    echo "setting $dir to 'reap'"
+    echo "controller run reap" | pantasks_client -c $dir/ptolemy.rc >& /dev/null
+  end
+
   set tmpfile = `mktemp /tmp/pantasks.XXXXXX`
 
@@ -276,7 +306,8 @@
     echo "waiting for jobs to clear on $dir"
 
+    # wait for at most 15 minutes (the stamp jobs may take 750 seconds to complete)
     set Njobs = 1
     set Nloop = 0
-    while ($Nloop < 30)
+    while ($Nloop < 90)
       echo "control status -nohost -state busy" | pantasks_client -c $dir/ptolemy.rc >& $tmpfile
       set Njobs = `awk '($3 == "BUSY"){print $0}' $tmpfile | wc -l`
