#!/bin/sh
# $RedRiver: backup_config,v 1.6 2009/05/21 22:41:08 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/cron \
/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/"
else
echo Not backing up /home, too large!
fi
tar czf /tmp/${FILE}.tar.gz $_list
echo backed up $_list
echo "\tto /etc/$FILE"