Hi
With /etc/periodic/daily/220.backup-pkgdb I would also suggest backing up
/var/db/ports dir
Maybe it's better to combine into one script.
diff -ruN etc.bak/defaults/periodic.conf etc/defaults/periodic.conf
--- etc.bak/defaults/periodic.conf 2011-10-15 04:37:28.879673119 +0400
+++ etc/defaults/periodic.conf 2011-10-15 04:30:48.599677268 +0400
@@ -78,6 +78,10 @@
daily_backup_pkgdb_enable="YES" #
Backup
/var/db/pkg
daily_backup_pkgdb_dir="/var/backups"
+# 230.backup-portdb
+daily_backup_portdb_enable="YES" #
Backup
/var/db/ports
+daily_backup_portdb_dir="/var/backups"
+
# 300.calendar
daily_calendar_enable="NO" # Run calendar
-a
diff -ruN etc.bak/periodic/daily/230.backup-portdb
etc/periodic/daily/230.backup-portdb
--- etc.bak/periodic/daily/230.backup-portdb 1970-01-01 03:00:00.000000000
+0300
+++ etc/periodic/daily/230.backup-portdb 2011-10-15 04:29:31.149682366
+0400
@@ -0,0 +1,51 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/periodic/daily/220.backup-portdb,v 1.2 2011/05/05
02:35:11 dougb 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
+
+rc=0
+
+case "$daily_backup_portdb_enable" in
+ [Yy][Ee][Ss])
+ bak="${daily_backup_portdb_dir:-/var/backups}"
+ bak_file="${bak}/portdb.bak.tbz"
+
+ port_dbdir=`make -f/usr/share/mk/bsd.port.mk -V PORT_DBDIR
2>/dev/null` ||
+ port_dbdir=/var/db/ports
+
+ if [ ! -d "$bak" ]
+ then
+ install -d -o root -g wheel -m 750 $bak || {
+ echo '$daily_backup_portdb_enable is enabled but' \
+ "$daily_backup_portdb_dbdir doesn't exist" ;
+ exit 2 ; }
+ fi
+
+ echo ''
+ echo 'Backing up package db directory:'
+
+ new_bak_file=`mktemp ${bak_file}-XXXXX`
+
+ if tar -cjHf "${new_bak_file}" "$port_dbdir"
2>/dev/null; then
+ chmod 644 "${new_bak_file}"
+
+ if [ -e "${bak_file}.2" -a -e "${bak_file}" ];
then
+ unlink "${bak_file}.2"
+ mv "${bak_file}" "${bak_file}.2"
+ fi
+ [ -e "${bak_file}" ] && mv "${bak_file}"
"${bak_file}.2"
+ mv "${new_bak_file}" "${bak_file}"
+ else
+ rc=3
+ fi ;;
+esac
+
+exit $rc
--
? ?????????, With respect,
???? ???????? Oleg Ginzburg
================================E-mail: mailto: olevole@olevole.ru
Skype: olegginzburg
XMPP/Jabber: olevole@jabber.ru