diff options
author | Holger Levsen <holger@layer-acht.org> | 2015-08-04 15:13:14 +0200 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2015-08-04 15:13:14 +0200 |
commit | dfbd71c34b82f956133e362478d6228121e6d19e (patch) | |
tree | 28449645c0b0227f5c7af10efc1b4058b85f20cd | |
parent | 0a05e37c7d649a622de3f30239160a6402b817cd (diff) | |
download | jenkins.debian.net-dfbd71c34b82f956133e362478d6228121e6d19e.tar.xz |
reproducible: db maintenance only on jenkins
-rwxr-xr-x | bin/reproducible_maintenance.sh | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/bin/reproducible_maintenance.sh b/bin/reproducible_maintenance.sh index 49ef8ece..7b434a90 100755 --- a/bin/reproducible_maintenance.sh +++ b/bin/reproducible_maintenance.sh @@ -12,29 +12,31 @@ common_init "$@" DIRTY=false -# prepare backup -REP_RESULTS=/srv/reproducible-results -mkdir -p $REP_RESULTS/backup -cd $REP_RESULTS/backup - -# keep 30 days and the 1st of the month -DAY=(date -d "30 day ago" '+%d') -DATE=$(date -d "30 day ago" '+%Y-%m-%d') -if [ "$DAY" != "01" ] && [ -f reproducible_$DATE.db.xz ] ; then - rm -f reproducible_$DATE.db.xz -fi +if [ "$HOSTNAME" = "jenkins" ] ; then + # prepare backup + REP_RESULTS=/srv/reproducible-results + mkdir -p $REP_RESULTS/backup + cd $REP_RESULTS/backup + + # keep 30 days and the 1st of the month + DAY=(date -d "30 day ago" '+%d') + DATE=$(date -d "30 day ago" '+%Y-%m-%d') + if [ "$DAY" != "01" ] && [ -f reproducible_$DATE.db.xz ] ; then + rm -f reproducible_$DATE.db.xz + fi -# actually do the backup -DATE=$(date '+%Y-%m-%d') -if [ ! -f reproducible_$DATE.db.xz ] ; then - cp -v $PACKAGES_DB . + # actually do the backup DATE=$(date '+%Y-%m-%d') - mv -v reproducible.db reproducible_$DATE.db - xz reproducible_$DATE.db -fi + if [ ! -f reproducible_$DATE.db.xz ] ; then + cp -v $PACKAGES_DB . + DATE=$(date '+%Y-%m-%d') + mv -v reproducible.db reproducible_$DATE.db + xz reproducible_$DATE.db + fi -# provide copy for external backups -cp -v $PACKAGES_DB $BASE/ + # provide copy for external backups + cp -v $PACKAGES_DB $BASE/ +fi # delete old temp directories OLDSTUFF=$(find $REP_RESULTS -maxdepth 1 -type d -name "tmp.*" -mtime +2 -exec ls -lad {} \;) |