Search:
<pre> #!/bin/bash PATH=/opt/csw/bin:/usr/bin:/usr/sbin:/usr/ccs/bin:/opt/SUNWspro/bin:/opt/csw/gcc3/bin:/usr/sbin:/usr/bin # Create a weekly full backup with nightly increments from previous weeks full backup. # Remove incremental backups from last week. # # See if there is an full backup for this week TODAY=$(/opt/csw/bin/gdate +'%Y-W%U-%u') OLDBACKUP=$(/opt/csw/bin/gdate +'%Y-W%U-%u' -d"-3 weeks") LASTFULL=$(/opt/csw/bin/gdate +'%Y-W%U-%u' -d"last saturday") SATURDAY=$(/opt/csw/bin/gdate +'%Y-W%U-%u' -d"saturday") echo "************************************************************************" echo "Today:" $TODAY echo "This Saturday:" $SATURDAY echo "Last Saturday:" $LASTFULL echo "Path used:" $PATH echo "************************************************************************" FILEDIR=/projects/obts/zfs_backups cd $FILEDIR LASTFULLFILE=$FILEDIR/zfs_backup_full.$LASTFULL SATURDAYFILE=$FILEDIR/zfs_backup_full.$SATURDAY INCREMENTALFILE=$FILEDIR/zfs_incr_backup.$TODAY ZFILESYSTEM=containers echo "Last Full backup name:" $LASTFULLFILE echo echo "Last Saturdays full backup filename:" $LASTFULLFILE echo # If today = sat (%u = 6) then # snapshot (zfs snapshot) and then put it into a file (zfs send snapshot> filename). echo "Checking to see if " $TODAY "is eq" $SATURDAY echo { if [ "$TODAY" = "$SATURDAY" ] ; then echo "Its saturday, we are doing a full backup..." echo "Full zfs snapshot" $ZFILESYSTEM $FILENAME echo zfs snapshot -r $ZFILESYSTEM@$SATURDAY zfs send -R $ZFILESYSTEM@SATURDAY > $SATURDAYFILE echo "Done doing a Satuday full backup." else echo "Its not Satuday..." echo echo "Does a full backup exist from last week?" echo { if [ -e "$LASTFULLFILE" ] ; then echo "Yes! A full backup exists." echo "Creating an incremental backup..." echo zfs snapshot -r $ZFILESYSTEM@$TODAY zfs send -R -i $ZFILESYSTEM@$LASTFULL $ZFILESYSTEM@$TODAY > $INCREMENTALFILE echo "Done doing an incremental backup" echo else echo "No Full backup exists. Creating a full backup..." echo zfs snapshot -r $ZFILESYSTEM@$LASTFULL zfs send -R $ZFILESYSTEM@$LASTFULL > $LASTFULLFILE echo "Done doing a full backup for last Saturday, because it did't exist)." echo fi } fi } # Next.. remove old incremental backup files. # Next.. remove old disk backups (keep 1 or 2 ?) # Restore Notes: # June 21, 2010 Doug Denny # # Assumption: You will restore to a point in time that is the snapshot. # # There are two snapshot backups that are important in a restore. # 1. The full snapshot backup, which can be used to restore an entire zfs filesystem. # 2. The (last) incrementatal backup which can be applied to get you to the lastest # backup that is good. # # Restoring a snapshot is destructive, it replaces a file system. # # </pre>
Summary:
This change is a minor edit.
To save this page you must answer this question:
What do you get when you remove the ARIS from Solaris?
Username: