Re: Backups (was: ssh question)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2003-12-14 at 18:54, Ed Wilts wrote:
> On Sun, Dec 14, 2003 at 01:42:03PM -0600, Michael Sullivan wrote:
> > I think this will work.  I'd like to make daily and weekly backups. 
> > What i need to know now is how to change the file name of each new
> > archive so that it doesn't write over the previous day's.  Any ideas?
> 
> Have a look at the multiple of options to the date command.  Something
> like this should work for you (thinking out loud without any testing):
> DM=`date +%d%b`
> tar zcf $DM.tar.gz <source>

Michael, you have a really bad habit of starting new threads using
existing subject lines.  Please start new threads with original posts
and pertinent subjects.

That said, here's a script I use for weekly backups to tape.  On Monday,
it does a full backup to tape.  Tuesday through Saturday, it does a
differential backup of any files changed in the last 24 hours.  On
Sunday, it does another differential backup and rewinds/ejects the tape.
#!/bin/bash
 
YESTERDAY=`date +'%d %b %Y'`
DIRS="/etc /home /root /var"
START=`date +%s`
 
echo "*** Starting Backup - `date` ***"
 
if [ `mt -f /dev/nst0 status | grep -c ONLINE` == 0 ]; then
        # Drive not ready
        echo "Drive is OFFLINE, exiting!"
        exit 1;
fi
 
find $DIRS -type s > /tmp/backup-sockets.list
 
if [ `date +%u` == 1 ]; then
        # It's Monday, let's erase and do full backup!
        mt -f /dev/st0 rewind
        mt -f /dev/st0 retension
        mt -f /dev/st0 erase
        tar cpf /dev/nst0 $DIRS -P -W -X /tmp/backup-sockets.list
elif [ `date +%u` == 7 ]; then
        # EOW, let's do an incremental and eject
        # Let's do verbose on the incrementals
        tar cpf /dev/nst0 --newer "$YESTERDAY" $DIRS -P -W -X
/tmp/backup-sockets.list
        mt -f /dev/st0 rewoffl;
else
        # Let's do an incremental backup
        # Let's do verbose on the incrementals
        tar cpf /dev/nst0 --newer "$YESTERDAY" $DIRS -P -W -X
/tmp/backup-sockets.list
fi

echo "*** Backup Complete - `date` ***"
 
END=`date +%s`
DIFF=$((END - START))
echo
echo -n "***** Total Run Time: "
HRS=`expr $DIFF / 3600`
MIN=`expr $DIFF % 3600 / 60`
SEC=`expr $DIFF % 3600 % 60`
 
if [ $HRS -gt 0 ]; then
        echo -n "$HRS hrs "
fi
if [ $MIN -gt 0 ]; then
        echo -n "$MIN mins "
fi
if [ $SEC -gt 0 ]; then
        echo -n "$SEC secs "
fi
echo " *****"
echo
echo


-- 
Jason Dixon, RHCE
DixonGroup Consulting
http://www.dixongroup.net


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux