]> git.decadent.org.uk Git - dak.git/blob - config/debian/cron.daily
[rmurray] Migrate from /org to /srv for debian.org config.
[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
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 > $base/backup/dump_$(date +%Y.%m.%d-%H:%M:%S)
38
39 ################################################################################
40
41 TS=$(($TS+1)); echo Archive maintenance timestamp $TS: $(date +%X)
42 cd $configdir
43 $scriptsdir/update-bugdoctxt
44 $scriptsdir/update-mirrorlists
45 $scriptsdir/update-mailingliststxt
46
47 ################################################################################
48
49 TS=$(($TS+1)); echo Archive maintenance timestamp $TS: $(date +%X)
50 lockfile $LOCKAC
51 cd $accepted
52 rm -f REPORT
53 dak process-accepted -pa *.changes | tee REPORT | \
54      mail -s "Install for $(date +%D)" ftpmaster@ftp-master.debian.org
55 chgrp debadmin REPORT
56 chmod 664 REPORT
57
58 TS=$(($TS+1)); echo Archive maintenance timestamp $TS: $(date +%X)
59
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 dak make-suite-file-list
68
69 TS=$(($TS+1)); echo Archive maintenance timestamp $TS: $(date +%X)
70
71 # Update fingerprints
72 # [JT - disabled, dak import-ldap-fingerprints currently can ask questions]
73 #dak import-ldap-fingerprints
74
75 # Generate override files
76 cd $overridedir
77 dak make-overrides
78
79 # Update task overrides for testing and unstable
80 # [JT 2004-02-04 disabled; copying in by hand for now]
81 #cat $extoverridedir/task | perl -ne 'print if /^\S+\sTask\s\S+(,\s*\S+)*$/;' > override.sarge.extra.main
82 #cat $extoverridedir/task | perl -ne 'print if /^\S+\sTask\s\S+(,\s*\S+)*$/;' > override.sid.extra.main
83
84 # FIXME
85 rm -f override.potato.all3 override.sid.all3
86 for i in main contrib non-free; do cat override.potato.$i >> override.potato.all3; done
87 for i in main contrib non-free main.debian-installer; do cat override.sid.$i >> override.sid.all3; done
88
89 TS=$(($TS+1)); echo Archive maintenance timestamp $TS: $(date +%X)
90
91 # Generate Packages and Sources files
92 cd $configdir
93 apt-ftparchive generate apt.conf
94 # Generate *.diff/ incremental updates
95 dak generate-index-diffs
96 # Generate Release files
97 dak generate-releases
98
99 TS=$(($TS+1)); echo Archive maintenance timestamp $TS: $(date +%X)
100
101 # Clean out old packages
102 dak clean-suites
103 dak clean-queues
104
105 TS=$(($TS+1)); echo Archive maintenance timestamp $TS: $(date +%X)
106
107 # Needs to be rebuilt, as files have moved.  Due to unaccepts, we need to
108 # update this before wanna-build is updated.
109 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
110 apt-ftparchive generate apt.conf.buildd
111
112 TS=$(($TS+1)); echo Archive maintenance timestamp $TS: $(date +%X)
113
114 cd $scriptsdir
115 ./mkmaintainers
116 ./copyoverrides
117 ./mklslar
118 ./mkfilesindices
119 ./mkchecksums
120 #
121 # Fetch bugs information before unchecked processing is allowed again.
122 $base/testing/britney allowdaklock bugs || true
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=$base/backup/dump_$(date +%Y.%m.%d-%H:%M:%S)
133 pg_dump projectb > $POSTDUMP
134 (cd $base/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 $base/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 $configdir
172 $scriptsdir/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)