[BACK]Return to backup_config CVS log [TXT][DIR] Up to [local] / openbsd / backup_config

File: [local] / openbsd / backup_config / backup_config (download)

Revision 1.5, Thu May 21 22:25:39 2009 UTC (15 years, 4 months ago) by andrew
Branch: MAIN
Changes since 1.4: +6 -1 lines

needs to run as root to back many of the things up, so don't let me forget it!

#!/bin/sh
# $RedRiver: backup_config,v 1.4 2009/05/21 22:05:06 andrew Exp $

if [ `id -u` -ne 0 ]; then 
	echo You should run this as root! >&2
	exit 255
fi

FILE=`hostname -s`-`date +%Y-%m-%d`
local _maxhomesize=20480

local _list="/root \
  /etc \
  /var/backups \
  /var/www/conf"

local _mcfile=`grep '^### .*\.mc' /etc/mail/sendmail.cf | cut -d ' ' -f 2`
if [ X"${_mcfile}" != X"" ]; then
  _list="${_list} /usr/share/sendmail/cf/${_mcfile}"
fi

local _homesize=`du -ks /home/ | awk '{print $1}'`
if [ $_homesize -lt $_maxhomesize ]; then
	_list="${_list} /home/"
fi

tar czvf /tmp/${FILE}.tar.gz $_list