PLEX86  x86- Virtual Machine (VM) Program
 Plex86  |  CVS  |  Mailing List  |  Download  |  Linux  |  Newsgroups

Linux Backup with Modification Date Filter 1605


Your Ad Here

Your Ad Here

For completeness, I am following up on my original question regarding the need for a Linux based backup solution that uses modification dates as the basis for an exclude filter.

I was able to use rsnapshot, which uses rsync, and took advantage of its excludefile filter feature.

I wrote a bash script that acts as a wrapper to rsnapshot which first generates a modification-date filter, then applies rsnapshot to the resulting file list.

The script is called rsnapshotbackup.sh and sources (includes) bashroutines.incl. Both files are listed below. I've also included a sample email generated on successfully running this script.

rich

RSNAPSHOTBACKUP rsnapshot backup with modification-date filtering release 0.90

copyright (C) 2006 business learning incorporated

script start: 2006-06-26 23:04:01

Linux Backup with Modification Date Filter 1606
On Tue, 13 Jun 2006 18:45:48 -0700, richbl Perhaps the script below does something close to what you want. Your selection test seems backwards to me; I think that...

checking samba folder for backup... samba folder (-mnt-shares-username) confirmed

mounting samba share... share (--main-username) mounted

creating exclude file... exclude file (-home-username-rsnapshotusername.excl) created

running rsnapshot (rsnapshot -chome-username-rsnapshotusername.conf daily)... rsnapshot successful

unmounting samba share... share (--main-username) unmounted

script end: 2006-06-26 23:04:08

script end time: 00:00:07

RSNAPSHOTBACKUP.SH:

#!-bin-bash

############################################################################## # # RSNAPSHOTBACKUP # rsnapshot backup with modification-date filtering # release 0.90 # # copyright (C) 2006 business learning incorporated # # This program is free software; you can redistribute it and-or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # ############################################################################## # # DESCRIPTION: # # archive files over samba with modification date earlier than # BACKUPSTARTDATE using rsnapshot and the rsync excludefile list # (EXCLUDEFILE), and optionally (EMAILSEND) emails script diagnostics # to user (EMAILADDR) upon script completion # # USAGE: # # rsnapshotbackup rsnapshotbackuppoint rsnapshotbackupinterval # e.g.: rsnapshotbackup mybackuppoint daily # # where: rsnapshotbackuppoint: backup locations per 'man rsnapshot' # rsnapshotbackupinterval: backup interval per 'man rsnapshot' # # REQUIRES: # # - rsnapshot package (tested against release 1.2.9), and dependencies # - rsnapshot.conf (RSNAPSHOTCONF) with the following values set: # # excludefile (enabled): EXCLUDEFILE as generated in this script # e.g.:home-username-rsnapshotexample.excl # # all other rsnapshot.conf values must be configured accordingly before # script use, per 'man rsnapshot' # # - user edits to script are made only in the section labeled "user defines" # - script must be run as root (for share access privileges) # - bashroutines.incl must be co-located with this script # # NOTES: # # for rsnapshot to run its own diagnostics against RSNAPSHOTCONF # (e.g., rsnapshot -c rsnapshotexample.conf du), rsnapshot expects # BACKUPMOUNTPOINT and EXCLUDEFILE to be persistent # ##############################################################################

Linux Backup with Modification Date Filter 1607
Jean-David Beyer Correct. Technically, these full backups are actually very long-term incremental backups. I have a rolling...

# # includes # . bashroutines.incl

# # user defines # SNAPSHOTNAMEARGS=(diane rich) SNAPSHOTINTERVALARGS=(daily weekly monthly)

checkforrootuser checkargsyntax "$1" "$2"

BACKUPSTARTDATE="0601220000" # 2006-01-22 SCRIPTPATH="-home-username-" RSNAPSHOTPATH="-usr-local-bin-" EMAILSEND=1

case "$1" in ${SNAPSHOTNAMEARGS0}) BACKUPMOUNTPOINT="-mnt-shares-Diane" SAMBASHARE="--main-diane" SAMBAUSERNAME="sambausername" SAMBAPbuttWORD= ;; ${SNAPSHOTNAMEARGS1}) BACKUPMOUNTPOINT="-mnt-shares-Rich" SAMBASHARE="--main-rich" SAMBAUSERNAME="sambausername" SAMBAPbuttWORD= ;; "*") exit 1 ;; esac

# # script defines # RSNAPSHOTCONF="${SCRIPTPATH}rsnapshot${1}.conf" EXCLUDEFILE="${SCRIPTPATH}rsnapshot${1}.excl" LOGFILE="${SCRIPTPATH}rsnapshot${1}.log" BACKUPSTARTDATEREFFILE="${SCRIPTPATH}rsnapshot${1}.ref" EMAILSUBJSUCCESS="Backup of $SAMBASHARE $2" EMAILSUBJFAILURE="Backup of $SAMBASHARE $2 FAILED" SCRIPTFAIL=0 SCRIPTSAMBAMOUNTFAIL=0 SCRIPTSTARTTIME=$(date +%s) SCRIPTENDTIME=$SCRIPTSTARTTIME

How to update old Firefox browser under Suse Linux
Thorsten Meininger on Sunday 21 May 2006 10:03 If you want to override the older version. Then try: make install (in the...

# # create-open log file # echo " tee $LOGFILE echo tee -a $LOGFILE echo "RSNAPSHOTBACKUP" tee -a $LOGFILE echo "rsnapshot backup with modification-date filtering" tee -a $LOGFILE echo "release 0.90" tee -a $LOGFILE echo tee -a $LOGFILE echo "copyright (C) 2006 business learning incorporated" tee -a $LOGFILE echo " tee -a $LOGFILE echo tee -a $LOGFILE echo "script start: `date +%Y-%m-%d" "%T`" tee -a $LOGFILE echo tee -a $LOGFILE

# # create-confirm samba folder # echo "checking samba folder for backup..." tee -a $LOGFILE if ! -d $BACKUPMOUNTPOINT ; then mkdir $BACKUPMOUNTPOINT

if $? -eq 0 ; then echo "no samba folder found, folder ($BACKUPMOUNTPOINT) created" tee -a $LOGFILE echo tee -a $LOGFILE else echo "samba folder ($BACKUPMOUNTPOINT) creation FAILED" tee -a $LOGFILE echo tee -a $LOGFILE SCRIPTFAIL=1 fi

else echo "samba folder ($BACKUPMOUNTPOINT) confirmed" tee -a $LOGFILE echo tee -a $LOGFILE fi

# # mount samba share # if $SCRIPTFAIL -eq 0 ; then echo "mounting samba share..." tee -a $LOGFILE smbmount $SAMBASHARE $BACKUPMOUNTPOINT -o username=$SAMBAUSERNAME,pbuttword=$SAMBAPbuttWORD

if $? -eq 0 ; then echo "share ($SAMBASHARE) mounted" tee -a $LOGFILE echo tee -a $LOGFILE else echo "share ($SAMBASHARE) mount FAILED" tee -a $LOGFILE echo tee -a $LOGFILE SCRIPTFAIL=1 SCRIPTSAMBAMOUNTFAIL=1 fi

fi

# # create exclude filter list (based on BACKUPSTARTDATEREFFILE) # if $SCRIPTFAIL -eq 0 ; then echo "creating exclude file..." tee -a $LOGFILE

touch -t "$BACKUPSTARTDATE" "$BACKUPSTARTDATEREFFILE" find "$BACKUPMOUNTPOINT" -not -newer "$BACKUPSTARTDATEREFFILE" sed -e "s^$BACKUPMOUNTPOINT- $BACKUPMOUNTPOINT" rm -f "$BACKUPSTARTDATEREFFILE" rm -f filestoexclude echo "exclude file ($EXCLUDEFILE) created" tee -a $LOGFILE echo tee -a $LOGFILE fi

# # run rsnapshot backup # if $SCRIPTFAIL -eq 0 ; then echo "running rsnapshot (rsnapshot -c $RSNAPSHOTCONF $2)..." tee -a $LOGFILE "$RSNAPSHOTPATH"rsnapshot -c $RSNAPSHOTCONF $2

if $? -eq 0 ; then echo "rsnapshot successful" tee -a $LOGFILE echo tee -a $LOGFILE else echo "rsnapshot FAILED" tee -a $LOGFILE echo tee -a $LOGFILE SCRIPTFAIL=1 fi

fi

# # unmount samba share # if $SCRIPTSAMBAMOUNTFAIL -eq 0 ; then echo "unmounting samba share..." tee -a $LOGFILE smbumount $BACKUPMOUNTPOINT

How to add GNOME to an existing Linux with KDE and switch between them
On Sun, 21 May 2006 06:40:37 +0000, George Dainis I buttume it's on the DVD- because it's...
changing mainboard, keeping linux
On Wed, 14 Jun 2006 16:27:42 +0200, rembremading It is possible. You have to evaluate the devices on both boards to...

if $? -eq 0 ; then echo "share ($SAMBASHARE) unmounted" tee -a $LOGFILE echo tee -a $LOGFILE else echo "share ($SAMBASHARE) unmount FAILED" tee -a $LOGFILE echo tee -a $LOGFILE SCRIPTFAIL=1 fi

fi

# # calculate script end time # SCRIPTENDTIME=$(date +%s) ENDSCRIPT="script end: `date +%Y-%m-%d" "%T`" SCRIPTDURATION=$$SCRIPTENDTIME - $SCRIPTSTARTTIME HOURS=$$SCRIPTDURATION 3600 MINUTES=$($SCRIPTDURATION 60) - ($HOURS * 60) SECONDS=$$SCRIPTDURATION % 60

# # close log file # echo $ENDSCRIPT tee -a $LOGFILE echo " tee -a $LOGFILE echo tee -a $LOGFILE printf "script end time: %02d:%02d:%02d-n" $HOURS $MINUTES $SECONDS tee -a $LOGFILE echo tee -a $LOGFILE

# # email results # if ( $SCRIPTFAIL -eq 0 && $EMAILSEND -eq 1 ); then echo "emailing results..." echo "email sent" echo else echo "emailing FAILURE results..." echo "email ($EMAILADDR) sent" echo fi

# # delete log file # rm -f $LOGFILE

exit 0

BASHROUTINES.INCL:

############################################################################## # # BASHROUTINES.INCL # various bash functions # release 0.90 # # copyright (C) 2006 business learning incorporated # # This program is free software; you can redistribute it and-or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # ##############################################################################

############################################################################## # # parseargs() argtotest arglistarray correctusagestr # # returns: 0 1 (no-bad argument found) # depends: none # ############################################################################## parseargs() { local ARGLIST="$3" local BADARG=1 local PbuttEDARRAY

PbuttEDARRAY=(`echo "$2"`)

do if "$1" = "$element" ; then BADARG=0; fi if ! "$ARGLIST" = ; then ARGLIST="${ARGLIST}"; fi ARGLIST="${ARGLIST}${element}" done

return "$BADARG" }

############################################################################## # # checkargsyntax() arg1 arg2 # # returns: none exit 1 # depends: parseargs() # ############################################################################## checkargsyntax() { local BADARG1=0 local BADARG2=0 local NAMESLIST= local INTERVALLIST=

NAMESLIST=(`parseargs "$1" "$ARRAYTOPbutt" "$NAMESLIST"`) BADARG1="$?"

INTERVALLIST=(`parseargs "$2" "$ARRAYTOPbutt" "$INTERVALLIST"`) BADARG2="$?"

if ( $BADARG1 -eq 1 $BADARG2 -eq 1 ); then echo echo "usage: ${0} ${NAMESLIST} ${INTERVALLIST}" echo exit 1 fi }

############################################################################## # # checkforrootuser() # # returns: none exit 1 # depends: none # ############################################################################## checkforrootuser() { if `id -u` != "0" ; then echo echo "root privileges required" echo exit 1 fi }



Your Ad Here

List | Previous | Next

Linux Backup with Modification Date Filter 1606

Linux groups from Newsgroups

The #1 Usenet Provider on the Internet

Network Settings In VMWare Player