cron.daily 3.4 KB
Newer Older
J
James Troup 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
#! /bin/sh
#
# Executed daily via cron, out of troup's crontab.

set -e
export SCRIPTVARS=/org/non-us.debian.org/katie/vars-non-US
. $SCRIPTVARS

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

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

NOTICE="$ftpdir/Archive_Maintenance_In_Progress"

cleanup() {
  rm -f "$NOTICE"
}
trap cleanup 0

rm -f "$NOTICE"
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

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

echo "Creating pre-daily-cron-job backup of projectb database..."
pg_dump projectb > /org/non-us.debian.org/backup/dump_$(date +%Y.%m.%d-%H:%M:%S)

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

36 37 38 39
update-readmenonus

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

40 41 42 43
if [ ! -z "$(find "$accepted" -name \*.changes -maxdepth 1 -mindepth 1)" ]; then
  cd $accepted
  rm -f REPORT
  kelly -pa *.changes | tee REPORT | \
J
James Troup 已提交
44
     mail -s "Non-US Install for $(date +%D)" ftpmaster@ftp-master.debian.org
45 46
  chgrp debadmin REPORT
  chmod 664 REPORT
J
James Troup 已提交
47 48
else
  echo "kelly: Nothing to install."
49
fi
J
James Troup 已提交
50 51 52 53 54 55

cd $masterdir
symlinks -d -r $ftpdir

cd $masterdir
jenna
J
sync  
James Troup 已提交
56 57 58 59 60 61 62 63 64

# Generate override files
cd $overridedir
denise
# FIXME
rm -f override.potato.all3
for i in main contrib non-free; do cat override.potato.$i >> override.potato.all3; done

# Generate Packages and Sources files
J
James Troup 已提交
65
cd $masterdir
J
James Troup 已提交
66
apt-ftparchive generate apt.conf-non-US
J
James Troup 已提交
67 68
# Generate Release files
ziyi
69 70 71

# Clean out old packages
rhona
R
Ryan Murray 已提交
72
shania
73

J
James Troup 已提交
74
# Generate the Maintainers file
J
James Troup 已提交
75
cd $indices
J
James Troup 已提交
76 77 78
charisma > .new-maintainers_versions
mv -f .new-maintainers_versions Maintainers_Versions
sed -e "s/~[^  ]*\([   ]\)/\1/" < Maintainers_Versions | awk '{printf "%-20s ", $1; for (i=2; i<=NF; i++) printf "%s ", $i; printf "\n";}' > .new-maintainers
J
James Troup 已提交
79 80 81
mv -f .new-maintainers Maintainers
gzip -9v <Maintainers >.new-maintainers.gz
mv -f .new-maintainers.gz Maintainers.gz
J
James Troup 已提交
82 83 84 85
gzip -9v <Maintainers_Versions >.new-maintainers_versions.gz
mv -f .new-maintainers_versions.gz Maintainers_Versions.gz
rm -f Maintainers_Versions

J
James Troup 已提交
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
cd $masterdir
copyoverrides
mklslar
mkchecksums

rm -f $NOTICE
echo Archive maintenance finished at $(date +%X)

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

echo "Creating post-daily-cron-job backup of projectb database..."
pg_dump projectb > /org/non-us.debian.org/backup/dump_$(date +%Y.%m.%d-%H:%M:%S)

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

J
sync  
James Troup 已提交
101 102 103 104 105
# Vacuum the database
echo "VACUUM; VACUUM ANALYZE;" | psql projectb 2>&1 | grep -v "^NOTICE:  Skipping.*only table owner can VACUUM it$"

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

J
James Troup 已提交
106 107
# Send a report on NEW/BYHAND packages
helena | mail -e -s "[non-US] NEW and BYHAND on $(date +%D)" ftpmaster@ftp-master.debian.org
J
James Troup 已提交
108 109
# and one on crufty packages
rene | mail -e -s "[non-US] rene run for $(date +%D)" ftpmaster@ftp-master.debian.org
J
James Troup 已提交
110 111

################################################################################
J
James Troup 已提交
112 113
ulimit -m 90000 -d 90000 -s 10000 -v 90000

J
sync  
James Troup 已提交
114
run-parts --report /org/non-us.debian.org/scripts/distmnt
J
James Troup 已提交
115 116

echo Daily cron scripts successful.