3 # Script to be run from crontab on buildlogs host.
4 # Moves buildlogs around.
6 # Expected directory structure:
8 # root/$(dist)/$(arch)/
14 # Note that we look for root/*/*/.new/*.info, so don't place any additional
17 root="/home/services/ftpd/buildlogs"
18 ADDLOG="/home/services/httpd/html/pld-buildlogs/scripts/addlog.php"
20 if test -f /etc/buildlogs-mover.conf ; then
21 . /etc/buildlogs-mover.conf
24 for n in $root/*/*/.new ; do
25 if test ! -d $n ; then
26 echo "$n doesn't exists or ain't directory"
29 break # don't check all
34 info_val="$(cat "$info" 2>/dev/null)"
35 if echo "$info_val" | grep -q '^END$' ; then
36 status=$(echo "$info_val" | grep '^Status:' | sed -e 's/.*: *//')
41 # this script is run from cron, so this should go through mail
43 echo "bad buildlog status: $status in $info:" 1>&2
47 rm "$info" 2>/dev/null
51 archdir="$(dirname "$(dirname "$info")")"
52 file=$(basename "$info" .info)
53 if test -f "$archdir/.new/$file"; then
54 if test -f "$archdir/OK/$file" ; then
55 mv -f "$archdir/OK/$file" "$archdir/prevOK/$file"
57 rm -f "$archdir/"{OK,FAIL}"/$file"
58 mv -f "$archdir/.new/$file" "$archdir/$s/$file"
59 $ADDLOG "$archdir/$s/$file"
60 rm "$info" 2>/dev/null
65 for info in $root/*/*/.new/*.info ; do
66 if test -f "$info" ; then