Fetch exit status and check for double eps.
authorfredrik <fredrik@959494ce-11ee-0310-bf91-de5d638817bd>
Mon, 29 May 2006 20:47:28 +0000 (20:47 +0000)
committerfredrik <fredrik@959494ce-11ee-0310-bf91-de5d638817bd>
Mon, 29 May 2006 20:47:28 +0000 (20:47 +0000)
git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/utils@629 959494ce-11ee-0310-bf91-de5d638817bd

autodlctl

index 6bac751..1b52a58 100755 (executable)
--- a/autodlctl
+++ b/autodlctl
@@ -22,7 +22,7 @@ function getnext
     fi
     unset badsizesl
     if [ -r "$d/.autodl/badsizes" ]; then
-       badsizesl="$(sed -n "s/^0*$curep \(.*\)$/\1/p" "$d/.autodl/badsizes")"
+       badsizesl="$(sed -n "s/^0*$curep \([^#]*\)\( *#.*\)\?$/\1/p" "$d/.autodl/badsizes")"
     fi
     if [ -n "$badsizesl" ]; then
        read -a badsizes <<<"$badsizesl"
@@ -37,7 +37,8 @@ function getnext
        done
     fi
     infofile="$d/.autodl/rtinfo"
-    args=(-e "$fsexpr" -t "$tag $curep" -I "$infofile")
+    estatfile="$d/.autodl/estat"
+    args=(-e "$fsexpr" -t "$tag $curep" -I "$infofile" -E "$estat" -x "curep=$curep")
     if [ -e "$d/.autodl/wait" ]; then
        args=("${args[@]}" -w)
     fi
@@ -58,6 +59,10 @@ function getnext
     trap "intr=y; kill -INT $pid" USR1 INT
     wait $pid
     stat=$?
+    if [ -r "$estatfile" ]; then
+       estat="`cat "$estatfile"`"
+       rm -f "$estatfile"
+    fi
     if [ "$intr" = y ]; then
        echo "$tag interrupted"
     else
@@ -74,7 +79,7 @@ function getnext
                echo "$tag" >>"$HOME/dc/autodl/faulty"
            fi
        else
-           echo "episode $curep of $tag done"
+           echo "episode $curep of $tag done (estat: \"$estat\")"
            case "$epfrom" in
                badlist)
                    echo -en "${tag}\n${curep}\n" >>"$HOME/dc/autodl/baddone"
@@ -94,8 +99,14 @@ function getnext
                    fi
                    ;;
                curep)
-                   echo -en "${tag}\n${curep}\n" >>"$HOME/dc/autodl/done"
-                   let curep++
+                   if [ "$estat" = dbl ]; then
+                       echo -en "${tag}\n${curep}\n" >>"$HOME/dc/autodl/done"
+                       echo -en "${tag}\n$((${curep} + 1))\n" >>"$HOME/dc/autodl/done"
+                       let curep+=2
+                   else
+                       echo -en "${tag}\n${curep}\n" >>"$HOME/dc/autodl/done"
+                       let curep++
+                   fi
                    echo "$curep" >"$d/.autodl/curep"
                    if [ -r "$d/.autodl/maxep" ]; then
                        if [ "$curep" -gt "`cat "$d/.autodl/maxep"`" ]; then