Enable wait mode.
[utils.git] / autodlctl
index 78ef0e6..6bac751 100755 (executable)
--- a/autodlctl
+++ b/autodlctl
@@ -38,6 +38,9 @@ function getnext
     fi
     infofile="$d/.autodl/rtinfo"
     args=(-e "$fsexpr" -t "$tag $curep" -I "$infofile")
+    if [ -e "$d/.autodl/wait" ]; then
+       args=("${args[@]}" -w)
+    fi
     if [ -r "$d/.autodl/uarg" ]; then
        uarg="`cat "$d/.autodl/uarg"`"
     elif [ -e "$d/.autodl/autouarg" ]; then
@@ -182,6 +185,10 @@ while [ "$done" != y ]; do
                        pid="`cat "$HOME/dc/autodl/run/$tag"`"
                        echo "sending SIGUSR1 to $pid"
                        kill -USR1 "$pid"
+                       while [ -e "$HOME/dc/autodl/run/$tag" ]; do
+                           echo "waiting for it to exit"
+                           sleep 1
+                       done
                    else
                        echo "could not find pid for $tag"
                    fi