Check the logfile exists
authorSteve McIntyre <steve@einval.com>
Thu, 20 Dec 2018 16:01:01 +0000 (16:01 +0000)
committerSteve McIntyre <steve@einval.com>
Thu, 20 Dec 2018 16:01:01 +0000 (16:01 +0000)
bin/requeue_by_log

index 83a1138..b24910b 100755 (executable)
@@ -15,21 +15,25 @@ for LOGFILE in $@; do
            exit 1
            ;;
     esac
-    PKG_VER_ARCH=$(basename $LOGFILE .log)
-    BUILDFILE=$(grep -rl $PKG_VER_ARCH $IN | tail -1)
-    if [ "$BUILDFILE"x = ""x ]; then
-       echo "Can't find job for $PKG_VER_ARCH"
+    if [ -f "$LOGFILE" ]; then
+       PKG_VER_ARCH=$(basename $LOGFILE .log)
+       BUILDFILE=$(grep -rl $PKG_VER_ARCH $IN | tail -1)
+       if [ "$BUILDFILE"x = ""x ]; then
+           echo "Can't find job for $PKG_VER_ARCH"
+       else
+           case "$BUILDFILE" in
+               *.proc)
+                   rm -v $LOGFILE
+                   BUILDFILE=$(basename $BUILDFILE)
+                   echo "Requeuing $BUILDFILE"
+                   ~build/bin/requeue $BUILDFILE
+                   ;;
+               *)
+                   echo "Ignoring non-proc file $BUILDFILE"
+                   ;;
+           esac
+       fi
     else
-       case "$BUILDFILE" in
-           *.proc)
-               rm -v $LOGFILE
-               BUILDFILE=$(basename $BUILDFILE)
-               echo "Requeuing $BUILDFILE"
-               ~build/bin/requeue $BUILDFILE
-               ;;
-           *)
-               echo "Ignoring non-proc file $BUILDFILE"
-               ;;
-       esac
+       echo "Can't find logfile $LOGFILE, ignoring"
     fi
 done