LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 02-18-2010, 03:35 PM   #1
z01krh
Member
 
Registered: May 2009
Posts: 34

Rep: Reputation: 0
backup script multiple gzips into one bzip2 or gzip


OK I have a backup script basically is this

Code:
BACKUP_DIRS="/etc /boot /root /home"
BACKUP_FOLDER="/tmp/system_backup/

for DIR in ${BACKUP_DIRS}
do

# so instead of /var/www as a file name we get var.www.tar
TARBALL_FILE_NAME=`echo ${DIR} | sed 's/.\(.*\)/\1/' | sed -e 's///./g'`

   tar -czpmf ${BACKUP_FOLDER}/${TARBALL_FILE_NAME}.tar ${DIR}
   sleep 1

done
All the folders get dumped into seperate gzip files.
Now I want all the gzip files in the backup folder into one final gzip or bzip2 file. My goal for this is to get one file instead of multiple so I can scp or ftp the one file to another file share. Which would be easier to send one file than a bunch of files.

Thanks

Last edited by z01krh; 02-18-2010 at 03:36 PM.
 
Old 02-18-2010, 04:13 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650
How about:

Code:
BACKUP_DIRS="/etc /boot /root /home"
BACKUP_FOLDER="/tmp/system_backup/
NOW=$(date +%F-%s)

tar -czpmf ${BACKUP_FOLDER}/backup_${NOW}.tar.gz ${BACKUP_DIRS}
..?
 
Old 02-19-2010, 10:22 AM   #3
z01krh
Member
 
Registered: May 2009
Posts: 34

Original Poster
Rep: Reputation: 0
Thanks man that did the trick.
 
  


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
gzip but keep the original file, and bzip2 - multiple files to one file? SirTristan Linux - Newbie 4 10-20-2009 03:37 AM
CPAN.pm needs either the external programs tar, gzip and bzip2 anndy Linux - Newbie 4 09-27-2008 07:09 AM
Backup Script from Multiple Drives to one Big Drive robinhood1995 LinuxQuestions.org Member Success Stories 5 03-26-2005 06:17 PM
bzip2 and gzip ust Linux - Software 1 02-08-2005 10:26 AM
bzip2 vs.gzip mikeshn Linux - Software 2 09-20-2003 09:30 AM


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

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration