regenerating /var/db/pkg

Lars Engels lars.engels at 0x20.net
Thu Apr 22 12:54:03 UTC 2010


On Thu, Apr 22, 2010 at 03:21:16PM +0300, Eitan Adler wrote:
> >
> > Just asking opinions, if people want this, I'll make a patch and
> > file a PR.
> >
> 
> Is this script correct?
> 
> #!/bin/sh
> #
> # $FreeBSD: src/etc/periodic/daily/210.backup-aliases,v 1.6.36.1.2.1
> 2009/10/25 01:10:29 kensmith Exp $
> #
> 
> # If there is a global system configuration file, suck it in.
> #
> if [ -r /etc/defaults/periodic.conf ]
> then
>     . /etc/defaults/periodic.conf
>     source_periodic_confs
> fi
> 
> bak=/var/backups
> db_loc="/var/db/pkg";
> bk_loc="/$bak/pkgdb.bak.tar"
> 
> case "$daily_backup_pkgdb_enable" in
>     [Yy][Ee][Ss])
> 	if [ ! -d $db_loc ]
> 	then
> 	    echo '$daily_backup_pkgdb_enable is enabled but' \
> 		"$db_loc doesn't exist"
> 	    rc=2
> 	else
> 	    rc=0
> 
> 	    echo ""
> 	    echo "Backing up mail aliases:"
> 
> 	    if [ ! -f $bk_loc ]
> 	    then
> 		echo "no $bk_loc"
> 		tar -cjf $bk_loc $db_loc || rc=3
> 	    fi
> 	fi;;
> 
>     *)  rc=0;;
> esac
> 
> exit $rc

Hmm, I guess you shouldn't backup /var/foo to /var/bar. If /var is lost,
your backup is gone, too.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20100422/c8f505fd/attachment.pgp


More information about the freebsd-hackers mailing list