#!/bin/sh # $AFresh1: backup_config,v 1.13 2010/02/10 20:57:07 andrew Exp $ if [ `id -u` -ne 0 ]; then echo You should run this as root! >&2 exit 255 fi FILE=/tmp/`hostname -s`-`date +%Y-%m-%d`.tar.gz local _maxhomesize=`dc -e '50 1024 * p'` local _list="/root \ /etc \ /var/backups \ /var/cron \ /var/www/conf" [ -e /var/www/etc ] && _list="${_list} /var/www/etc" 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 find $_list -type f -or -type l | sed -e 's/^\///' | tar -czf ${FILE} -C / -I - echo backed up $_list to echo "\t$FILE"