]> git.pld-linux.org Git - projects/buildlogs.git/commitdiff
- prevent race-condition and buildlogs vanishing (by witekfl)
authorPaweł Gołaszewski <blues@pld-linux.org>
Mon, 24 Dec 2007 11:38:11 +0000 (11:38 +0000)
committerPaweł Gołaszewski <blues@pld-linux.org>
Mon, 24 Dec 2007 11:38:11 +0000 (11:38 +0000)
helpers/buildlogs-mover.conf
helpers/buildlogs-mover.sh

index f02d90443e13a187bbbcd43a9210916e1a5602c3..39dd2eec8417f9922c97676896ec01de0bbf0334 100644 (file)
@@ -1,3 +1,3 @@
 # This is location of buildlogs tree:
 
-root="/home/services/ftpd/pub/pld-buildlogs"
+root="/home/services/ftp/pub/pld-buildlogs"
index ceac668853d6eb761e0476103c9bfe3778d39765..a5613ba45f8ec1ef9dfe9ac251c004e545caeaac 100644 (file)
@@ -15,6 +15,7 @@
 # directories there.
 
 root="/home/services/ftpd/buildlogs"
+ADDLOG="/home/services/httpd/html/pld-buildlogs/scripts/addlog.php"
 
 if test -f /etc/buildlogs-mover.conf ; then
   . /etc/buildlogs-mover.conf
@@ -32,7 +33,6 @@ handle_info () {
   info="$1"
   info_val="$(cat "$info" 2>/dev/null)"
   if echo "$info_val" | grep -q '^END$' ; then
-    rm "$info" 2>/dev/null || return
     status=$(echo "$info_val" | grep '^Status:' | sed -e 's/.*: *//')
     case $status in
       OK ) s=OK ;;
@@ -44,16 +44,20 @@ handle_info () {
        echo "#v+" 1>&2
        echo "$info_val" 1>&2
        echo "#v-" 1>&2
+       rm "$info" 2>/dev/null
        return
         ;;
     esac
     archdir="$(dirname "$(dirname "$info")")"
     file=$(basename "$info" .info)
-    if test -f "$archdir/OK/$file" ; then
-      mv -f "$archdir/OK/$file" "$archdir/prevOK/$file"
-    fi
-    rm -f "$archdir/"{OK,FAIL}"/$file"
-    mv -f "$archdir/.new/$file" "$archdir/$s/$file"
+    if test -f "$archdir/.new/$file"; then
+           if test -f "$archdir/OK/$file" ; then
+                   mv -f "$archdir/OK/$file" "$archdir/prevOK/$file"
+           fi
+           rm -f "$archdir/"{OK,FAIL}"/$file"
+           mv -f "$archdir/.new/$file" "$archdir/$s/$file"
+           $ADDLOG "$archdir/$s/$file"
+           rm "$info" 2>/dev/null
   fi
 }
 
This page took 0.043216 seconds and 4 git commands to generate.