Date: Tue, 5 Mar 2013 08:59:45 -0800 (PST) From: Carl Johnson <carlj@peak.org> To: FreeBSD-gnats-submit@freebsd.org Subject: conf/176668: [PATCH] Only save pkgdb if it has changed Message-ID: <201303051659.r25GxjD8029959@bonsai.localnet> Resent-Message-ID: <201303051700.r25H02xB041580@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 176668 >Category: conf >Synopsis: [PATCH] Only save pkgdb if it has changed >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Mar 05 17:00:02 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Carl Johnson >Release: FreeBSD 9.1-RELEASE amd64 >Organization: >Environment: System: FreeBSD bonsai.localnet 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243825: Tue Dec 4 09:23:10 UTC 2012 root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 >Description: The periodic daily scripts normally save the entire state of the pkgdb and a backup, even when there are no changes. That is a considerable use of backup space when there is no change. The accompanying patch to /etc/periodic/daily/220.backup-pkgdb saves only if there have been some changes in the /var/db/pkg/ directory. I have tested the same patch on 8.3-RELEASE and 9.0-RELEASE systems. >How-To-Repeat: The normal behaviour is to always save. >Fix: --- /etc/periodic/daily/220.backup-pkgdb.orig 2013-03-01 10:45:28.199970000 -0800 +++ /etc/periodic/daily/220.backup-pkgdb 2013-02-27 15:32:45.201213000 -0800 @@ -32,6 +32,12 @@ echo '' echo 'Backing up package db directory:' + changes=$(find $pkg_dbdir -newer $bak_file -print 2>&1 | wc -l) + if [ "$changes" -eq "0" ] ; then + echo 'No changes.' + exit 0 + fi + new_bak_file=`mktemp ${bak_file}-XXXXX` if tar -cjHf "${new_bak_file}" "$pkg_dbdir" 2>/dev/null; then @@ -47,5 +53,6 @@ rc=3 fi ;; esac +echo 'Done.' exit $rc >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201303051659.r25GxjD8029959>