cron.daily 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #! /bin/bash
  2. #
  3. # Run daily via cron, out of dak's crontab.
  4. set -e
  5. set -o pipefail
  6. set -u
  7. export SCRIPTVARS=/srv/ftp-master.debian.org/dak/config/debian/vars
  8. . $SCRIPTVARS
  9. # common functions are "outsourced"
  10. . "${configdir}/common"
  11. ################################################################################
  12. TMPFILE=$( mktemp -p ${TMPDIR} )
  13. function cleanup {
  14. ERRVAL=$?
  15. rm -f ${TMPFILE}
  16. exit ${ERRVAL}
  17. }
  18. trap cleanup SIGHUP SIGINT SIGPIPE SIGTERM EXIT ERR
  19. # log to dinstall's logfile instead of sending email
  20. PROGRAM="cron.daily"
  21. # Start logging
  22. NOW=`date "+%Y.%m.%d-%H:%M:%S"`
  23. LOGFILE="$logdir/daily_${NOW}.log"
  24. exec >> "$LOGFILE" 2>&1
  25. # get the latest list of wnpp bugs and their source packages
  26. wget -q -O${TMPFILE} --ca-directory=/etc/ssl/ca-debian https://qa.debian.org/data/bts/wnpp_rm
  27. chmod go+r ${TMPFILE}
  28. mv ${TMPFILE} /srv/ftp-master.debian.org/scripts/masterfiles/wnpp_rm
  29. # Push files over to security
  30. # The key over there should have the following set for the ssh key:
  31. # command="/usr/bin/xzcat | /usr/bin/psql -1 -c 'DELETE FROM external_files; COPY external_files (id, filename, size, md5sum, last_used, sha1sum, sha256sum, created, modified) FROM STDIN' obscurity"
  32. psql -c 'COPY files (id, filename, size, md5sum, last_used, sha1sum, sha256sum, created, modified) TO STDOUT' projectb | \
  33. xz -3 | \
  34. ssh -o BatchMode=yes -o ConnectTimeout=30 -o SetupTimeout=30 -2 \
  35. -i ${base}/s3kr1t/push_external_files dak@security-master.debian.org sync
  36. # Update wanna-build dump
  37. echo "Update wanna-build database dump"
  38. $base/dak/scripts/nfu/get-w-b-db
  39. reports
  40. clean_debbugs
  41. # Generate list of override disparities
  42. dak override-disparity | gzip -9 > ${webdir}/override-disparity.gz
  43. # Generate stats about the new queue
  44. dak stats new ${webdir}/NEW-stats.yaml 2> /dev/null
  45. # Generate the contributor data
  46. # FIXME: In a day or three, when this worked from cron without
  47. # failure, redirect its output to dev/null. Alternatively until then
  48. # enrico added a --quiet and we use that.
  49. REQUESTS_CA_BUNDLE=/etc/ssl/ca-debian/ca-certificates.crt dc-tool --mine="${configdir}/contributor.source" --auth-token @"${base}/s3kr1t/contributor.auth" --source ftp.debian.org --post
  50. ${scriptsdir}/link_morgue.sh
  51. ################################################################################
  52. echo "Finally, all is done, compressing logfile"
  53. exec > /dev/null 2>&1
  54. bzip2 -9 "$LOGFILE"