# 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
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 ;;
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
}