]> git.decadent.org.uk Git - dak.git/blob - config/debian/cron.daily
ssh to buildd and run 'trigger.daily before we 'finish'. Drop merkel push. [rmurray...
[dak.git] / config / debian / cron.daily
1 #! /bin/sh
2 #
3 # Executed daily via cron, out of dak's crontab.
4
5 set -e
6 export SCRIPTVARS=/org/ftp.debian.org/dak/config/debian/vars
7 . $SCRIPTVARS
8
9 ################################################################################
10
11 echo Archive maintenance started at $(date +%X)
12 TS=0
13
14 NOTICE="$ftpdir/Archive_Maintenance_In_Progress"
15 LOCKCU="$lockdir/daily.lock"
16 LOCKAC="$lockdir/unchecked.lock"
17
18 cleanup() {
19   rm -f "$NOTICE"
20   rm -f "$LOCKCU"
21 }
22 trap cleanup 0
23
24 rm -f "$NOTICE"
25 lockfile -l 3600 $LOCKCU
26 cat > "$NOTICE" <<EOF
27 Packages are currently being installed and indices rebuilt.
28 Maintenance is automatic, starting at 13:52 US Central time, and
29 ending at about 15:30.  This file is then removed.
30
31 You should not mirror the archive during this period.
32 EOF
33
34 ################################################################################
35
36 echo "Creating pre-daily-cron-job backup of projectb database..."
37 pg_dump projectb > /org/ftp.debian.org/backup/dump_$(date +%Y.%m.%d-%H:%M:%S)
38
39 ################################################################################
40
41 TS=$(($TS+1)); echo Archive maintenance timestamp $TS: $(date +%X)
42 update-bugdoctxt
43 update-mirrorlists
44 update-mailingliststxt
45
46 ################################################################################
47
48 TS=$(($TS+1)); echo Archive maintenance timestamp $TS: $(date +%X)
49 lockfile $LOCKAC
50 cd $accepted
51 rm -f REPORT
52 dak process-unchecked -pa *.changes | tee REPORT | \
53      mail -s "Install for $(date +%D)" ftpmaster@ftp-master.debian.org
54 chgrp debadmin REPORT
55 chmod 664 REPORT
56
57 TS=$(($TS+1)); echo Archive maintenance timestamp $TS: $(date +%X)
58
59 cd $masterdir
60 dak check-overrides
61 rm -f $LOCKAC
62
63 symlinks -d -r $ftpdir
64
65 TS=$(($TS+1)); echo Archive maintenance timestamp $TS: $(date +%X)
66
67 cd $masterdir
68 dak make-suite-file-list
69
70 TS=$(($TS+1)); echo Archive maintenance timestamp $TS: $(date +%X)
71
72 # Update fingerprints
73 # [JT - disabled, dak import-ldap-fingerprints currently can ask questions]
74 #dak import-ldap-fingerprints
75
76 # Generate override files
77 cd $overridedir
78 dak make-overrides
79
80 # Update task overrides for testing and unstable
81 # [JT 2004-02-04 disabled; copying in by hand for now]
82 #cat $extoverridedir/task | perl -ne 'print if /^\S+\sTask\s\S+(,\s*\S+)*$/;' > override.sarge.extra.main
83 #cat $extoverridedir/task | perl -ne 'print if /^\S+\sTask\s\S+(,\s*\S+)*$/;' > override.sid.extra.main
84
85 # FIXME
86 rm -f override.potato.all3 override.sid.all3
87 for i in main contrib non-free; do cat override.potato.$i >> override.potato.all3; done
88 for i in main contrib non-free main.debian-installer; do cat override.sid.$i >> override.sid.all3; done
89
90 TS=$(($TS+1)); echo Archive maintenance timestamp $TS: $(date +%X)
91
92 # Generate Packages and Sources files
93 cd $masterdir
94 apt-ftparchive generate apt.conf
95 # Generate *.diff/ incremental updates
96 dak generate-index-diffs
97 # Generate Release files
98 dak generate-releases
99
100 TS=$(($TS+1)); echo Archive maintenance timestamp $TS: $(date +%X)
101
102 # Clean out old packages
103 dak clean-suites
104 dak clean-queues
105
106 TS=$(($TS+1)); echo Archive maintenance timestamp $TS: $(date +%X)
107
108 # Needs to be rebuilt, as files have moved.  Due to unaccepts, we need to
109 # update this before wanna-build is updated.
110 psql projectb -A -t -q -c "SELECT filename FROM queue_build WHERE suite = 5 AND queue = 0 AND in_queue = true AND filename ~ 'd(sc|eb)$'" > $dbdir/dists/unstable_accepted.list
111 apt-ftparchive generate apt.conf.buildd
112
113 TS=$(($TS+1)); echo Archive maintenance timestamp $TS: $(date +%X)
114
115 mkmaintainers
116 copyoverrides
117 mklslar
118 mkfilesindices
119 mkchecksums
120 #
121 # Fetch bugs information before unchecked processing is allowed again.
122 /org/ftp.debian.org/testing/britney bugs
123 rm -f $NOTICE
124 ssh buildd@buildd /org/wanna-build/trigger.daily
125
126 rm -f $LOCKCU
127 echo Archive maintenance finished at $(date +%X)
128
129 ################################################################################
130
131 echo "Creating post-daily-cron-job backup of projectb database..."
132 POSTDUMP=/org/ftp.debian.org/backup/dump_$(date +%Y.%m.%d-%H:%M:%S)
133 pg_dump projectb > $POSTDUMP
134 (cd /org/ftp.debian.org/backup; ln -sf $POSTDUMP current)
135
136 ################################################################################
137
138 TS=$(($TS+1)); echo Archive maintenance timestamp $TS: $(date +%X)
139
140 # Vacuum the database
141 echo "VACUUM; VACUUM ANALYZE;" | psql projectb 2>&1 | grep -v "^NOTICE:  Skipping.*only table owner can VACUUM it$"
142
143 ################################################################################
144
145 TS=$(($TS+1)); echo Archive maintenance timestamp $TS: $(date +%X)
146
147 # Send a report on NEW/BYHAND packages
148 dak queue-report | mail -e -s "NEW and BYHAND on $(date +%D)" ftpmaster@ftp-master.debian.org
149 # and one on crufty packages
150 dak cruft-report | tee $webdir/cruft-report-daily.txt | mail -e -s "Debian archive cruft report for $(date +%D)" ftpmaster@ftp-master.debian.org
151
152 ################################################################################
153
154 # Run mirror-split
155
156 #time dak mirror-split
157
158 ################################################################################
159
160 TS=$(($TS+1)); echo Archive maintenance timestamp $TS: $(date +%X)
161
162 ulimit -m 90000 -d 90000 -s 10000 -v 90000
163
164 run-parts --report /org/ftp.debian.org/scripts/distmnt
165
166 echo Daily cron scripts successful.
167
168 TS=$(($TS+1)); echo Archive maintenance timestamp $TS: $(date +%X)
169
170 # Stats pr0n
171 cd $masterdir
172 update-ftpstats $base/log/* > $base/misc/ftpstats.data
173 R --slave --vanilla < $base/misc/ftpstats.R
174
175 TS=$(($TS+1)); echo Archive maintenance timestamp $TS: $(date +%X)