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