#!/bin/bash ################################################################################ # # File: $RCSfile: backup,v $ # Revision: $Revision: 1.7 $ # Description: This script backs up the system in a consistent way # Author: Andrew@DeFaria.com # Created: Tue Jul 27 15:00:11 PDT 2004 # Modified: $Date: 2011/05/26 06:17:20 $ # Language: Bash # # (c) Copyright 2000-2005, ClearSCM, Inc., all rights reserved. # ################################################################################ # Full Backup backup=/sbin/dump dumppath=/backup filesystems="sda1 sdb1" compression=9 if [ -f /etc/dump.excludes ]; then excludes="-E /etc/dump.excludes" else excludes="" fi if [ $(id -u) -ne 0 ]; then echo "You must be root to backup" exit 1 fi function usage { type="$1" echo "Usage: backup " exit 1 } # usage type="$1" host=$(hostname) if [ "$type" = "full" ]; then rm -f $dumppath/$host.*.$type.backup rm -f $dumppath/$host.*.$type.backup.log rm -f $dumppath/$host.*.$type.list level=0 elif [ "$type" = "incremental" ]; then level=1 else usage $type fi for fs in $filesystems; do log=$dumppath/$host.$fs.$type.backup.log $backup -$level\ -A $dumppath/$host.$fs.$type.list\ -f $dumppath/$host.$fs.$type.backup\ -z$compression\ $excludes\ -u /dev/$fs > $log 2>&1 done