>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 r...@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: _______________________________________________ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"