LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 05-24-2008, 04:24 AM   #1
jdeeptir
LQ Newbie
 
Registered: Mar 2008
Posts: 7

Rep: Reputation: 0
incremental backup


Dear all,

I hafe written shell script for incremental backup of a folder.I can add only files which are newly added to the folder after the full backup .


but i want to write script for incremental backup for old files which are modified after full backup.


Please help me solve this issue.


With Regards,
Keerti
 
Old 05-24-2008, 04:48 AM   #2
b0uncer
Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
It might help if you could post the script, or the relevant parts of it, to show what you have done so far and how. For example how you pick up the new files among all files, do you just compare already-backed-up filelist against current-files list or something?

You could also save information about the files' last modification times and compare them, that way you should get the modified files too. For example "find" can help achieving this.
 
Old 05-24-2008, 04:55 AM   #3
jdeeptir
LQ Newbie
 
Registered: Mar 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Dear sir ,

this is my script for incremental backup

#`echo $1 $2 $3 $4 >/mnt/ide4/p1`
#`mkdir -p $1/fullbackup/$2/$4`
`find $1/fullbackup -name $2 >$3/path`
v1=0
while read line
do v1=`expr $v1 + 1`;
done <"$3/path"
for i in `seq 1 $v1` ;do read var$i;done <$3/path

if [ "$var1" != "" ]
then
ppath1=`echo $var1 |awk -F"/" '{for(i=2;i<NF;i++) print "/" $i }'`
`echo $ppath1 >$3/ppath1`
path1=`echo $ppath1|sed 's/ //g'`
`echo $path1 >$3/path1`
`ls -l $path1>$3/org1`
`grep $2 $3/org1 > $3/org`
date=`cat $3/org |awk '{print $7 " " $6 " " $8}'`
`echo $date>$3/fullbackupdat`
`awk '{if ( $2 == "Jan") $2=1
else if ($2 == "Feb") $2=2
else if ($2 == "Mar") $2=3
else if ($2 == "Apr") $2=4
else if ($2 == "May") $2=5
else if ($2 == "Jun") $2=6
else if ($2 == "Jul") $2=7
else if ($2 == "Aug") $2=8
else if ($2 == "Sep") $2=9
else if ($2 == "Oct") $2=10
else if ($2 == "Nov") $2=11
else if ($2 == "Dec") $2=12
print $0}' $3/fullbackupdat >$3/fullbackupdate`

d=`cat $3/fullbackupdate|awk '{print $1}'`
m=`cat $3/fullbackupdate|awk '{print $2}'`
t1=`cat $3/fullbackupdate|awk '{print $3}'`
t=`echo $t1|awk -F":" '{print $1}'`
`echo $t>$3/t`
`ls -lR $3/$2>$3/k2`
`sed -e '/^d/d' $3/k2> $3/k`
`awk '{if ( $6 == "Jan") $6=1
else if ($6 == "Feb") $6=2
else if ($6 == "Mar") $6=3
else if ($6 == "Apr") $6=4
else if ($6 == "May") $6=5
else if ($6 == "Jun") $6=6
else if ($6 == "Jul") $6=7
else if ($6 == "Aug") $6=8
else if ($6 == "Sep") $6=9
else if ($6 == "Oct") $6=10
else if ($6 == "Nov") $6=11
else if ($6 == "Dec") $6=12
printf ("%s %d %s %s %d %d %d %2d %s\n",$1,$2,$3,$4,$5,$6,$7,$8,$9)}' $3/k >$3/kk`
`cat $3/kk |awk -v d1="$d" -v m1="$m" '{ if ( $7 > d1 ) {if ( $6 >= m1 ) {print $9}}}' >$3/cc1`
`cat $3/kk |awk -v d1="$d" -v m1="$m" '{ if ( $7 < d1 ) {if ( $6 > m1 ) {print $9}}}' >>$3/cc1`
`cat $3/kk |awk -v d1="$d" -v m1="$m" -v t1="$t" '{ if ( $7 = d1 ) {if ( $6 = m1 ) {if ($8 > t1){print $9}}}}'>>$3/cc1`

#if [ -s $3/cc1 ]
#then
#/usr/webroot/cgi/wizard/test $1 $2 $3
#fi
fi

With regards,
keerti
 
Old 05-24-2008, 06:36 AM   #4
Jim44
Member
 
Registered: Feb 2006
Location: Atlanta, Georgia, USA
Distribution: Mint, Ubuntu, Centos
Posts: 52

Rep: Reputation: 15
Just a suggestion, you can avoid reinventing the wheel by using snapback2 or bacula or any number of other backup utilities.
 
Old 05-24-2008, 06:40 AM   #5
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
You can use find's -mtime or -newer with find to determine which files are new or modified either in a given period of time or compared to a reference time. Also look in the tar info manual, Section 5.2. You can use timestamps to perform incremental dumps.

The ls -l command uses the mtime value which is what you want. If you want any change in permissions to cause a file to be backed up then you can use "ls -l --time=ctime".
 
Old 05-24-2008, 06:51 PM   #6
DavidMcCann
Senior Member
 
Registered: Jul 2006
Location: London
Distribution: CentOS, Salix
Posts: 2,953

Rep: Reputation: 767Reputation: 767Reputation: 767Reputation: 767Reputation: 767Reputation: 767Reputation: 767
I don't use a script or a utility: just plain old rsync. Have a look at the man page for it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Incremental backup Ammad Linux - Software 2 02-22-2008 03:41 PM
incremental backup problem venki Linux - Newbie 1 11-28-2006 02:08 PM
About incremental backup satimis Linux - Software 0 06-15-2006 04:01 AM
incremental backup .... redrobin77 Linux - Software 1 01-31-2006 05:29 AM
incremental backup reaky Linux - Software 3 03-10-2004 03:02 PM


All times are GMT -5. The time now is 07:01 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration