LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 05-16-2012, 11:30 AM   #1
krogerssolar
LQ Newbie
 
Registered: May 2012
Location: Colorado
Distribution: Centos 6
Posts: 9

Rep: Reputation: Disabled
Cool tar.gz backups not working


Hi all i have a Fedora Core 15 system setup with websites on it i have it backing up a few directory's when i try to make a bash script to scp over to a backup server my tar.gz files come out as 4.0K instead of a few Gigabytes any ideas here am i missing something commands are below

#! /bin/bash
cd /media/backups1/websites/
tar -pczf `date +%Y%m%d`home.tar.gz `date +%Y%m%d`home/
tar -pczf `date +%Y%m%d`html2.tar.gz `date +%Y%m%d`html2/
tar -pczf `date +%Y%m%d`moodledata.tar.gz `date +%Y%m%d`moodledata/
scp -r /media/backups1/websites/`date +%Y%m%d`home.tar.gz root@serverip:/media/backups
scp -r /media/backups1/websites/`date +%Y%m%d`html2.tar.gz root@serverip:/media/backups
scp -r /media/backups1/websites/`date +%Y%m%d`alldatabase.sql root@serverip:/media/backups
scp -r /media/backups1/websites/`date +%Y%m%d`moodledata.tar.gz root@serverip:/media/backups

Last edited by krogerssolar; 05-16-2012 at 11:31 AM.
 
Old 05-16-2012, 12:08 PM   #2
es0teric
Member
 
Registered: Apr 2007
Distribution: Ubuntu
Posts: 105

Rep: Reputation: 19
Not sure what's causing that problem, but I'd recommend only doing the timestamp calculation once at the beginning and storing the result in a variable.
 
Old 05-16-2012, 03:57 PM   #3
alinas
Member
 
Registered: Apr 2002
Location: UK, Sywell, EGBK
Distribution: RHEL, SuSE, CentOS, Debian, Ubuntu
Posts: 60

Rep: Reputation: 20
Did you look at your back up files?
EG:
Code:
tar tzvf `date +%Y%m%d`home.tar.gz
- that might give you a clue...
 
Old 05-16-2012, 04:21 PM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Code:
tar -pczf `date +%Y%m%d`home.tar.gz `date +%Y%m%d`home/
I don't understand the part highlighted in blue: have you got a directory whose name is
Code:
20120515home/
20120516home/
20120517home/
...
every day? Once you have solved the tar creation issue, you can spare the scp commands by feeding the remote machine through standard input over ssh, e.g.
Code:
tar -cpzf - /source_dir | ssh user@host "cat > /destination/$(date +%Y%m%d)_source_dir.tar.gz"
Hope this helps.
 
Old 05-16-2012, 04:27 PM   #5
krogerssolar
LQ Newbie
 
Registered: May 2012
Location: Colorado
Distribution: Centos 6
Posts: 9

Original Poster
Rep: Reputation: Disabled
colucix the highlighted blue part is created in another script when the main home folders and web directories are backed up

it looks like this im still working on it looks like my size issue has come back where its doubling my size i think i missed a cp command cp -vrfp /home/ /media/backups1/websites/`date +%Y%m%d`home/
 
  


Reply



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
[SOLVED] tar backups cbider Red Hat 3 05-20-2010 10:03 AM
Backups Using Tar (Question) Matey Linux - General 3 02-10-2009 06:38 AM
tar archival backups arbis Linux - Software 2 10-20-2008 09:24 PM
backups using tar and rsync cucolin@ Linux - Server 2 04-03-2007 12:25 AM
Incremental tar backups Pepe Linux - General 5 03-18-2002 03:31 AM

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

All times are GMT -5. The time now is 06:07 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