version 1.7, 2009/06/16 23:55:55 |
version 1.12, 2009/12/10 07:38:59 |
|
|
#!/bin/sh |
#!/bin/sh |
# $RedRiver: backup_config,v 1.6 2009/05/21 22:41:08 andrew Exp $ |
# $RedRiver: backup_config,v 1.11 2009/11/17 16:48:14 andrew Exp $ |
|
|
if [ `id -u` -ne 0 ]; then |
if [ `id -u` -ne 0 ]; then |
echo You should run this as root! >&2 |
echo You should run this as root! >&2 |
exit 255 |
exit 255 |
fi |
fi |
|
|
FILE=`hostname -s`-`date +%Y-%m-%d` |
FILE=/tmp/`hostname -s`-`date +%Y-%m-%d`.tar.gz |
local _maxhomesize=20480 |
local _maxhomesize=`dc -e '50 1024 * p'` |
|
|
local _list="/root \ |
local _list="/root \ |
/etc \ |
/etc \ |
|
|
/var/cron \ |
/var/cron \ |
/var/www/conf" |
/var/www/conf" |
|
|
|
[ -e /var/www/etc ] && _list="${_list} /var/www/etc" |
|
|
local _mcfile=`grep '^### .*\.mc' /etc/mail/sendmail.cf | cut -d ' ' -f 2` |
local _mcfile=`grep '^### .*\.mc' /etc/mail/sendmail.cf | cut -d ' ' -f 2` |
if [ X"${_mcfile}" != X"" ]; then |
if [ X"${_mcfile}" != X"" ]; then |
_list="${_list} /usr/share/sendmail/cf/${_mcfile}" |
_list="${_list} /usr/share/sendmail/cf/${_mcfile}" |
|
|
echo Not backing up /home, too large! |
echo Not backing up /home, too large! |
fi |
fi |
|
|
tar czf /tmp/${FILE}.tar.gz $_list |
find $_list -type f -or -type l | sed -e 's/^\///' | tar -czf ${FILE} -C / -I - |
|
|
echo backed up $_list |
echo backed up $_list to |
echo "\tto /etc/$FILE" |
echo "\t$FILE" |