[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] 2 commits: reproducible: maintenance: try to umount /proc only if it's actually mouunted
Mattia Rizzolo (@mattia)
gitlab at salsa.debian.org
Tue Oct 5 13:44:53 BST 2021
Mattia Rizzolo pushed to branch master at Debian QA / jenkins.debian.net
Commits:
fa802be1 by Mattia Rizzolo at 2021-10-05T14:25:39+02:00
reproducible: maintenance: try to umount /proc only if it's actually mouunted
Signed-off-by: Mattia Rizzolo <mattia at debian.org>
- - - - -
744aeb6b by Mattia Rizzolo at 2021-10-05T14:44:42+02:00
reproducible: db_backup: more verbose logging.
Signed-off-by: Mattia Rizzolo <mattia at debian.org>
- - - - -
2 changed files:
- bin/reproducible_db_backup.sh
- bin/reproducible_maintenance.sh
Changes:
=====================================
bin/reproducible_db_backup.sh
=====================================
@@ -17,34 +17,49 @@ common_init "$@"
#
set -euo pipefail
+_log() {
+ echo "$(date -u) - $*"
+}
+
# backup db
if [ "$HOSTNAME" = "$MAINNODE" ] ; then
- echo "$(date -u) - backup db and update public copy."
+ _log "backup db and update public copy."
+ echo
+
# prepare backup
BACKUPDIR=$BASE/debian/backups
mkdir -p $BACKUPDIR
# keep 30 days and the 1st of the month
+ _log "Deleting old backups…"
DAY=$(date -d "30 day ago" '+%d')
DATE=$(date -d "30 day ago" '+%Y-%m-%d')
BACKUPFILE="$BACKUPDIR/reproducible_$DATE.sql.xz"
if [ "$DAY" != "01" ] && [ -f "$BACKUPFILE" ] ; then
- rm -f "$BACKUPFILE"
+ rm -fv "$BACKUPFILE"
fi
# Make a daily backup of database
DATE=$(date '+%Y-%m-%d')
BACKUPFILE="$BACKUPDIR/reproducible_$DATE.sql"
- if [ ! -f "$BACKUPFILE.xz" ] ; then
- # make the backup
- DATE=$(date '+%Y-%m-%d')
+ if [ -f "$BACKUPFILE.xz" ] ; then
+ _log "The backup file $BACKUPFILE.xz already exists, skipping."
+ else
+ _log "Starting the backup now…"
+ set -x
pg_dump -x -O "$PGDATABASE" > "$BACKUPFILE"
xz "$BACKUPFILE"
# make the backup public
- ln -s -f "$BACKUPFILE.xz" $BASE/reproducible.sql.xz
+ ln -s -f -v "$BACKUPFILE.xz" $BASE/reproducible.sql.xz
# recreate documentation of database
postgresql_autodoc -d "$PGDATABASE" -t html -f "$BASE/reproducibledb"
+ set +x
fi
+ echo
+ _log "$(date -u) - done."
+else
+ _log "This script shouldn't be run outside of $MAINNODE"
+ exit 1
fi
=====================================
bin/reproducible_maintenance.sh
=====================================
@@ -432,8 +432,8 @@ cleanup_old_schroots() {
if [ ! -z "$OLDSTUFF" ] ; then
# try to unmount mounts first
for MP in $(find /schroots/ -maxdepth 1 -type d -regextype posix-extended -regex "$regex" -mtime +$AGE ) ; do
- if [ -d $MP/proc ] ; then
- sudo umount -l $MP/proc 2>/dev/null || echo "umount -l $MP/proc failed, continueing."
+ if [ -d $MP/proc ] && mountpoint -q "$MP/proc" ; then
+ sudo umount -l $MP/proc 2>/dev/null || echo "umount -l $MP/proc failed, continuing."
fi
done
echo
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/compare/02fccbf3b2ab930e1a9c8b12621283af1bcbaa7f...744aeb6bd1cd8d2854c2ee28efbfe50ae96c10bf
--
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/compare/02fccbf3b2ab930e1a9c8b12621283af1bcbaa7f...744aeb6bd1cd8d2854c2ee28efbfe50ae96c10bf
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/qa-jenkins-scm/attachments/20211005/30eb6bd3/attachment-0001.htm>
More information about the Qa-jenkins-scm
mailing list