Improvements to cron_dump_to_disk
authorStelian Pop <stelian@popies.net>
Mon, 5 May 2008 09:25:27 +0000 (09:25 +0000)
committerStelian Pop <stelian@popies.net>
Mon, 5 May 2008 09:25:27 +0000 (09:25 +0000)
CHANGES
examples/cron_dump_to_disk/backup
examples/cron_dump_to_disk/backup_rotate

diff --git a/CHANGES b/CHANGES
index b99fb6b1187137f66365d6827d2afceac503c54d..fcbde066be912405e64823ffc62dd7d77c02b230 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,4 @@
-$Id: CHANGES,v 1.291 2008/04/17 15:29:47 stelian Exp $
+$Id: CHANGES,v 1.292 2008/05/05 09:25:27 stelian Exp $
 
 Changes between versions 0.4b41 and 0.4b42 (released xxxxxxxxxxxxxxx)
 =====================================================================
@@ -37,7 +37,7 @@ Changes between versions 0.4b41 and 0.4b42 (released xxxxxxxxxxxxxxx)
        Thanks to Kenneth Porter <shiva@sewingwitch.com> for the bug
        report.
 
-9.     Cleanup the output of the 'cron_dump_to_disk' example.
+9.     Many improvements to the 'cron_dump_to_disk' example.
        Thanks to Aaron S. Hawley <ashawley@users.sourceforge.net> for
        the patch.
 
index d19beef0449e64a9f9d171770d6213b42e748595..d1de13687c41dd9fd5d2290ac3453c9d962dcc9d 100755 (executable)
@@ -31,10 +31,10 @@ fi
 # Configuration Parameters
 #
 
-BACKUPPART="/backup"
-BACKUPDIR="current"
+BACKUPPART=${BACKUPPART:-"/backup"}
+BACKUPDIR=${BACKUPDIR:-"current"}
 DUMPLOGARCH="$BACKUPPART/backup.dump.log.gz"
-FSTODUMP="/ /var /home /mnt/hdb1 /usr"
+FSTODUMP=${FSTODUMP:-/ /var /home /mnt/hdb1 /usr}
 DUMPFILESMODE="0644"
 DUMPFILESOWN="root.root"
 
@@ -81,17 +81,17 @@ if [ -d $BACKUPPART/$BACKUPDIR -a -w $BACKUPPART/$BACKUPDIR ]; then
 
    if [ `expr $SAVAIL - $SREQ` -gt "0" ]; then
       echo "done."
-      echo " Available: $SAVAIL MB Required: $SREQ MB."
+      echo "Available: $SAVAIL MB Required: $SREQ MB."
    else
       echo "no enough space!"
-      echo " There is not enough space left in $BACKUPPART for the backup!"
-      echo " Available: $SAVAIL MB Required: $SREQ MB."
+      echo "There is not enough space left in $BACKUPPART for the backup!"
+      echo "Available: $SAVAIL MB Required: $SREQ MB."
       echo -n "Remounting backup partition read-only ... "
       if ( mount $BACKUPPART -o remount,ro &> /dev/null ) then
          echo "done."
       else
          echo "failure!"
-         echo " There were problems remounting $BACKUPPART in read-only mode!"
+         echo "There were problems remounting $BACKUPPART in read-only mode!"
          echo "Aborting ${BACKUP} System Dump Backup."
          echo "Aborted."
          echo "-------------------------------------------------------------------------------"
@@ -120,14 +120,14 @@ if [ -d $BACKUPPART/$BACKUPDIR -a -w $BACKUPPART/$BACKUPDIR ]; then
          FSNAME=`echo $FS|tr / _|cut -b 2-`
       fi
       sync
-      echo -n " Starting dump of $FSNAME ( $FS ) ... "
+      echo -n "Starting dump of $FSNAME ( $FS ) ... "
       if ( dump -$DLEVEL $UPDATEDDATE -z -M -s 27306 -f $BACKUPPART/$BACKUPDIR/$FSNAME.$BTYPE. $FS &> $BACKUPPART/$BACKUPDIR/$FSNAME.log ) then
          echo "done."
       else
          echo "problems!"
-         echo " There where problems with the dump of $FSNAME ( $FS )."
-         echo " Check logfile $BACKUPPART/$BACKUPDIR/$FSNAME.log for more info"
-         echo " Also check log archive file $DUMPLOGARCH."
+         echo "There where problems with the dump of $FSNAME ( $FS )."
+         echo "Check logfile $BACKUPPART/$BACKUPDIR/$FSNAME.log for more info"
+         echo "Also check log archive file $DUMPLOGARCH."
       fi
       cat $BACKUPPART/$BACKUPDIR/$FSNAME.log |gzip >> $DUMPLOGARCH
       echo "-------------------------------------------------------------------------------" |gzip >> $DUMPLOGARCH
@@ -145,14 +145,14 @@ if [ -d $BACKUPPART/$BACKUPDIR -a -w $BACKUPPART/$BACKUPDIR ]; then
 
 else
    echo "problems!"
-   echo " There are problems with the directory structure."
-   echo " Check dirs: $BACKUPPART/$BACKUPDIR"
+   echo "There are problems with the directory structure."
+   echo "Check dirs: $BACKUPPART/$BACKUPDIR"
    echo -n "Remounting backup partition read-only ... "
    if ( mount $BACKUPPART -o remount,ro &> /dev/null ) then
       echo "done."
    else
       echo "failure!"
-      echo " There were problems remounting $BACKUPPART in read-only mode!"
+      echo "There were problems remounting $BACKUPPART in read-only mode!"
       echo "Aborting ${BACKUP} System Dump Backup."
       echo "Aborted."
       echo "-------------------------------------------------------------------------------"
@@ -169,13 +169,13 @@ if ( mount $BACKUPPART -o remount,ro &> /dev/null ) then
    echo "done."
 else
    echo "failure!"
-   echo " There were problems remounting $BACKUPPART in read-only mode!"
+   echo "There were problems remounting $BACKUPPART in read-only mode!"
    echo "Aborting ${BACKUP} System Dump Backup."
    echo "Aborted."
    echo "-------------------------------------------------------------------------------"
    exit 1
 fi
 
-echo "End of ${BACKUP} System Dump Backup."
+echo "### End of ${BACKUP} System Dump Backup ###"
 echo "Done."
 echo "-------------------------------------------------------------------------------"
index 2e8eeb9c6eb0817c5475bf6e091f34cfd39fa932..c3dc1fa2f7d21e17b6959b3dc3293830b3b4fd32 100755 (executable)
@@ -3,7 +3,7 @@
 # This script will redirect the backup directory to implement desired backup
 # schedules.
 #
-# Currently we will use just a seven day format were we just move a link
+# We will use just a seven day format where we just move a link
 # that represents the backup directory, to point to the day of the week.
 #
 
@@ -17,8 +17,8 @@ else
    REALDIR=`date +%A`
 fi
 
-BACKUPPART="/backup"
-BACKUPDIR="current"
+BACKUPPART=${BACKUPPART:-"/backup"}
+BACKUPDIR=${BACKUPDIR:-"current"}
 
 echo "### Start of Backup Rotation ###"
 echo "Using backup partition: $BACKUPPART"