# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# Homer: Are you saying you're never going to eat any animal again? What
+# about bacon?
+# Lisa: No.
+# Homer: Ham?
+# Lisa: No.
+# Homer: Pork chops?
+# Lisa: Dad, those all come from the same animal.
+# Homer: Heh heh heh. Ooh, yeah, right, Lisa. A wonderful, magical animal.
+
# exit on errors
set -e
# make sure to only use defined variables
# If we error out this one is called, *FOLLOWED* by cleanup above
function onerror() {
ERRDATE=$(date "+%Y.%m.%d-%H:%M:%S")
- cat "$LOGFILE" | mail -s "ATTENTION ATTENTION! dinstall error at ${ERRDATE} (Be quiet, Brain, or I'll stab you with a Q-tip)" cron@ftp-master.debian.org
+ cat "${STAGEFILE}.log" | mail -s "ATTENTION ATTENTION! dinstall error at ${ERRDATE} in ${STAGEFILE} - (Be quiet, Brain, or I'll stab you with a Q-tip)" cron@ftp-master.debian.org
}
########################################################################
Maintenance is automatic, starting at 01|07|13|19:52 UTC,
and ending about an hour later. This file is then removed.
-You should not mirror the archive during this period.
+You should not mirror the archive during this period. If you find this
+file on a Debian mirror please have a nice talk with the admin. They
+are doing something wrong.
EOF
}
find -maxdepth 1 -mindepth 1 -type f -name 'dump_*' \! -name '*.bz2' \! -name '*.gz' -mmin +720 |
while read dumpname; do
echo "Compressing $dumpname"
- bzip2 -9v "$dumpname"
+ bzip2 -9fv "$dumpname"
done
find -maxdepth 1 -mindepth 1 -type f -name "dumpall_*" \! -name '*.bz2' \! -name '*.gz' -mmin +720 |
while read dumpname; do
echo "Compressing $dumpname"
- bzip2 -9v "$dumpname"
+ bzip2 -9fv "$dumpname"
done
finddup -l -d $base/backup
}
if [ -f "${dbdir}/dinstallstart" ]; then
NOW=$(cat "${dbdir}/dinstallstart")
maillogfile
- mv "$LOGFILE" "$logdir/dinstall_${NOW}.log"
+ mv "$LOGFILE" "$logdir/dinstall_${NOW}.log"
logstats "$logdir/dinstall_${NOW}.log"
bzip2 -9 "$logdir/dinstall_${NOW}.log"
else
# Function to save which stage we are in, so we can restart an interrupted
# dinstall. Or even run actions in parallel, if we dare to, by simply
# backgrounding the call to this function. But that should only really be
-# done for things we dont care much about.
+# done for things we don't care much about.
#
# This should be called with the first argument being an array, with the
# members
ARGS='GO[@]'
local "${!ARGS}"
- if [ -f "${stagedir}/${FUNC}" ]; then
- stamptime=$(/usr/bin/stat -c %Z "${stagedir}/${FUNC}")
+ STAGEFILE="${stagedir}/${FUNC}"
+ if [ -f "${STAGEFILE}" ]; then
+ stamptime=$(/usr/bin/stat -c %Z "${STAGEFILE}")
unixtime=$(date +%s)
difference=$(( $unixtime - $stamptime ))
if [ ${difference} -ge 14400 ]; then
# it has to cd first!
cd ${configdir}
+ # Now redirect the output into $STAGEFILE.log. In case it errors out somewhere our
+ # errorhandler trap can then mail the contents of $STAGEFILE.log only, instead of a whole
+ # dinstall logfile. Short error mails ftw!
+ exec >> "${STAGEFILE}.log" 2>&1
+
if [ -f "${LOCK_STOP}" ]; then
log "${LOCK_STOP} exists, exiting immediately"
exit 42
# Make sure we are always at the same place.
cd ${configdir}
- touch "${stagedir}/${FUNC}"
+ touch "${STAGEFILE}"
if [ -n "${TIME}" ]; then
ts "${TIME}"
fi
+ # And the output goes back to the normal logfile
+ exec >> "$LOGFILE" 2>&1
+
+ # Now we should make sure that we have a usable dinstall.log, so append the $STAGEFILE.log
+ # to it.
+ cat "${STAGEFILE}.log" >> "${LOGFILE}"
+ rm -f "${STAGEFILE}.log"
+
if [ -f "${LOCK_STOP}" ]; then
log "${LOCK_STOP} exists, exiting immediately"
exit 42
ARGS=""
ERR="false"
)
-stage $GO
+stage $GO &
GO=(
FUNC="pgdump_pre"
ARGS=""
ERR="false"
)
-stage $GO
+stage $GO &
GO=(
FUNC="aptftpcleanup"