LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-02-2009, 05:35 AM   #1
petruha1983
LQ Newbie
 
Registered: Feb 2009
Posts: 15

Rep: Reputation: 0
Post differental back up with TAR


hi there...
i have a script to backup my server....
the normal backup is working great.
but the problem is with the differental..
here is the script...
#!/bin/bash
#
# Folders to Backup
PUBLIC="/windows/nas/public"


# Target Backup Locations
public_backup="/backup/public"


LIST="/tmp/backuplist_$$.txt"

#
echo "Starting backup at `date +%Y-%m-%d\ %H:%M:%S`"
echo ""

set $(date)

#
if test "$1" = "Tue" ; then


# weekly a full backup of "public" folder:
#
echo "Performing Full Backup of "public" folder..."
tar -zcvf "$public_backup/public_full_$6-$2-$3.tgz" $PUBLIC > "/$public_backup/public_full_$6-$2-$3.log"
#
echo "Removing incremental "public" backups..."
rm -f $public_backup/public_diff*
#
echo "Removing four week old full "public" folder backup..."
find $public_backup -depth -type f \( -ctime +27 -o -mtime +27 \) -print > $LIST
rm -f `cat $LIST`




else
# incremental backup of "public" folder:
#
#echo "Performing Incremental Backup "public" folder..."
#find $PUBLIC -depth -type f \( -ctime -5 -o -mtime -5 \) -print > $LIST
tar -zcvfT "$public_backup/public_diff_$6-$2-$3.tgz" "/tmp/backuplist_tmp.txt" > "$public_backup/public_diff_$6-$2-$3.log"
#rm -f "$LIST"



fi

#
echo ""
echo "Done!"
echo ""
echo "------------------------------------------------------------------------"
echo "Finished: `date +%Y-%m-%d\ %H:%M:%S`"
echo "------------------------------------------------------------------------"
echo ""
exit 0


the problem is that i am making a list of the files that need to be backed up - but the "tar" command doesn't read from the file it just making the the file itself - what syntax should be in order for it to work??
can anyone help me?
 
Old 02-02-2009, 05:45 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
I haven't fully studied your script, but I had two things jump out at me. First on this line:
tar -zcvfT "$public_backup/public_diff_$6-$2-$3.tgz" "/tmp/backuplist_tmp.txt" > "$public_backup/public_diff_$6-$2-$3.log"

The -f and -T options each take a file argument. -f <archivename> -T <filelist>

Don't separate the options from their arguments.

The second thing is I don't see how it is an incremental backup unless that you know that all of the files with "Tue" in the listing are new.

For an incremental backup use -g <timestamp_file> or --listed-incremental <timestamp_file>.
See the tar info manual (section 5.2) for examples.
 
Old 02-02-2009, 07:16 AM   #3
petruha1983
LQ Newbie
 
Registered: Feb 2009
Posts: 15

Original Poster
Rep: Reputation: 0
Thumbs up Thanks

thanks a lot..
you were totaly right.
the syntax "-T" wasnt in its place..
now everything works great.
thanks a lot.
 
  


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
cat | tar | mv: Back up question melikai Linux - Software 4 04-01-2008 07:21 AM
remote back up wiht GNU tar vlsi Linux - General 5 02-21-2008 06:40 PM
Can I back up hidden files using tar? opto Linux - Newbie 6 11-05-2006 09:35 AM
taking tar back up of only the directory structure procfs Linux - Newbie 3 09-04-2006 07:54 PM
move files in tar.gz back to into original folders GUIPenguin Linux - General 1 05-09-2005 12:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:32 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration