Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Apr 2010 15:21:16 +0300
From:      Eitan Adler <eitanadlerlist@gmail.com>
To:        Ruben de Groot <mail25@bzerk.org>, Doug Barton <dougb@freebsd.org>,  "Aryeh M. Friedman" <aryeh.friedman@gmail.com>, freebsd-hackers@freebsd.org
Subject:   Re: regenerating /var/db/pkg
Message-ID:  <o2oa0777e081004220521sae3b1b06o884fd8eadffc6931@mail.gmail.com>
In-Reply-To: <20100422111758.GA39338@ei.bzerk.org>
References:  <4BCE5ECC.6070202@gmail.com> <4BCFE209.20501@FreeBSD.org>  <20100422111758.GA39338@ei.bzerk.org>

next in thread | previous in thread | raw e-mail | index | archive | help
>
> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?o2oa0777e081004220521sae3b1b06o884fd8eadffc6931>