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

Annotation of openbsd/backup_config/backup_config, Revision 1.11

1.1       andrew      1: #!/bin/sh
1.11    ! andrew      2: # $RedRiver: backup_config,v 1.10 2009/11/05 23:26:34 andrew Exp $
1.5       andrew      3:
                      4: if [ `id -u` -ne 0 ]; then
                      5:        echo You should run this as root! >&2
                      6:        exit 255
                      7: fi
1.1       andrew      8:
1.9       andrew      9: FILE=/tmp/`hostname -s`-`date +%Y-%m-%d`.tar.gz
                     10: local _maxhomesize=`dc -e '50 1024 * p'`
1.3       andrew     11:
                     12: local _list="/root \
                     13:   /etc \
                     14:   /var/backups \
1.7       andrew     15:   /var/cron \
1.3       andrew     16:   /var/www/conf"
1.1       andrew     17:
1.2       andrew     18: local _mcfile=`grep '^### .*\.mc' /etc/mail/sendmail.cf | cut -d ' ' -f 2`
1.3       andrew     19: if [ X"${_mcfile}" != X"" ]; then
                     20:   _list="${_list} /usr/share/sendmail/cf/${_mcfile}"
                     21: fi
                     22:
                     23: local _homesize=`du -ks /home/ | awk '{print $1}'`
                     24: if [ $_homesize -lt $_maxhomesize ]; then
                     25:        _list="${_list} /home/"
1.6       andrew     26: else
                     27:        echo Not backing up /home, too large!
1.3       andrew     28: fi
                     29:
1.11    ! andrew     30: find $_list -type f -or -type l | sed -e 's/^\///' | tar -czf ${FILE} -C / -I -
1.6       andrew     31:
1.10      andrew     32: echo backed up $_list to
                     33: echo "\t$FILE"

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>