cron.daily 4.2 KB
Newer Older
J
James Troup 已提交
1 2
#! /bin/sh
#
3
# Executed daily via cron, out of katie's crontab.
J
James Troup 已提交
4 5

set -e
J
James Troup 已提交
6
export SCRIPTVARS=/org/ftp.debian.org/katie/vars
J
James Troup 已提交
7 8
. $SCRIPTVARS

J
James Troup 已提交
9
################################################################################
J
James Troup 已提交
10 11 12 13

echo Archive maintenance started at $(date +%X)

NOTICE="$ftpdir/Archive_Maintenance_In_Progress"
14 15
LOCKCU="$lockdir/daily.lock"
LOCKAC="$lockdir/unchecked.lock"
J
James Troup 已提交
16 17 18

cleanup() {
  rm -f "$NOTICE"
19
  rm -f "$LOCKCU"
J
James Troup 已提交
20 21 22 23
}
trap cleanup 0

rm -f "$NOTICE"
24
lockfile -l 3600 $LOCKCU
J
James Troup 已提交
25 26 27 28 29 30 31 32
cat > "$NOTICE" <<EOF
Packages are currently being installed and indices rebuilt.
Maintenance is automatic, starting at 13:52 US Central time, and
ending at about 15:30.  This file is then removed.

You should not mirror the archive during this period.
EOF

J
James Troup 已提交
33
################################################################################
J
James Troup 已提交
34

J
James Troup 已提交
35 36
echo "Creating pre-daily-cron-job backup of projectb database..."
pg_dump projectb > /org/ftp.debian.org/backup/dump_$(date +%Y.%m.%d-%H:%M:%S)
J
James Troup 已提交
37

J
James Troup 已提交
38
################################################################################
J
James Troup 已提交
39

J
James Troup 已提交
40 41
update-bugdoctxt
update-mirrorlists
42
update-mailingliststxt
J
James Troup 已提交
43

J
James Troup 已提交
44
################################################################################
J
James Troup 已提交
45

46
lockfile $LOCKAC
J
sync  
James Troup 已提交
47
cd $accepted
J
James Troup 已提交
48
rm -f REPORT
J
James Troup 已提交
49
kelly -pa *.changes | tee REPORT | \
J
James Troup 已提交
50 51 52 53 54
     mail -s "Install for $(date +%D)" ftpmaster@ftp-master.debian.org
chgrp debadmin REPORT
chmod 664 REPORT

cd $masterdir
55 56 57
cindy
rm -f $LOCKAC

J
James Troup 已提交
58 59
symlinks -d -r $ftpdir

J
James Troup 已提交
60 61
cd $masterdir
jenna
J
James Troup 已提交
62

A
Anthony Towns 已提交
63
# Update fingerprints
64 65
# [JT - disabled, emilie currently can ask questions]
#emilie
A
Anthony Towns 已提交
66

J
sync  
James Troup 已提交
67 68 69
# Generate override files
cd $overridedir
denise
70 71

# Update task overrides for testing and unstable
72 73 74
# [JT 2004-02-04 disabled; copying in by hand for now]
#cat $extoverridedir/task | perl -ne 'print if /^\S+\sTask\s\S+(,\s*\S+)*$/;' > override.sarge.extra.main
#cat $extoverridedir/task | perl -ne 'print if /^\S+\sTask\s\S+(,\s*\S+)*$/;' > override.sid.extra.main
75

J
sync  
James Troup 已提交
76
# FIXME
J
sync  
James Troup 已提交
77
rm -f override.potato.all3 override.sid.all3
J
sync  
James Troup 已提交
78
for i in main contrib non-free; do cat override.potato.$i >> override.potato.all3; done
J
sync  
James Troup 已提交
79
for i in main contrib non-free main.debian-installer; do cat override.sid.$i >> override.sid.all3; done
J
sync  
James Troup 已提交
80 81

# Generate Packages and Sources files
J
James Troup 已提交
82 83
cd $masterdir
apt-ftparchive generate apt.conf
84 85
# Generate *.diff/ incremental updates
tiffani
J
James Troup 已提交
86 87
# Generate Release files
ziyi
J
James Troup 已提交
88

89 90
# Clean out old packages
rhona
R
Ryan Murray 已提交
91
shania
J
James Troup 已提交
92

93 94
# Needs to be rebuilt, as files have moved.  Due to unaccepts, we need to
# update this before wanna-build is updated.
95
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
96 97
apt-ftparchive generate apt.conf.buildd

J
James Troup 已提交
98
mkmaintainers
J
James Troup 已提交
99 100 101
copyoverrides
mklslar
mkchecksums
102 103 104
#
# Fetch bugs information before unchecked processing is allowed again.
/org/ftp.debian.org/testing/britney bugs
J
James Troup 已提交
105
rm -f $NOTICE
106 107 108
sudo -u archvsync /home/archvsync/pushmerkel

rm -f $LOCKCU
J
James Troup 已提交
109 110
echo Archive maintenance finished at $(date +%X)

J
James Troup 已提交
111 112 113
################################################################################

echo "Creating post-daily-cron-job backup of projectb database..."
114 115 116
POSTDUMP=/org/ftp.debian.org/backup/dump_$(date +%Y.%m.%d-%H:%M:%S)
pg_dump projectb > $POSTDUMP
(cd /org/ftp.debian.org/backup; ln -sf $POSTDUMP current)
J
James Troup 已提交
117 118 119

################################################################################

J
sync  
James Troup 已提交
120 121 122 123 124
# Vacuum the database
echo "VACUUM; VACUUM ANALYZE;" | psql projectb 2>&1 | grep -v "^NOTICE:  Skipping.*only table owner can VACUUM it$"

################################################################################

J
James Troup 已提交
125 126
# Send a report on NEW/BYHAND packages
helena | mail -e -s "NEW and BYHAND on $(date +%D)" ftpmaster@ftp-master.debian.org
J
James Troup 已提交
127
# and one on crufty packages
128
rene | tee $webdir/rene-daily.txt | mail -e -s "rene run for $(date +%D)" ftpmaster@ftp-master.debian.org
J
James Troup 已提交
129 130 131

################################################################################

132 133
# Run billie

134
#time billie
135 136 137

################################################################################

J
James Troup 已提交
138 139 140 141 142
ulimit -m 90000 -d 90000 -s 10000 -v 90000

run-parts --report /org/ftp.debian.org/scripts/distmnt

echo Daily cron scripts successful.
143 144 145 146 147
# Stats pr0n

cd $masterdir
update-ftpstats $base/log/* > $base/misc/ftpstats.data
R --slave --vanilla < $base/misc/ftpstats.R