FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 07-10-2008, 10:04 PM
Kent West
 
Default Scripting Question - tar

I have this script (stripped down to basics):


#!/bin/bash
sourceDir='/home/' # Directory you're backing up
targetDir='/TERASTATIONBACKUP/GOSHEN/'$(date +%Y) # Destination
directory for the tarball
targFileBase='GoshensHome' # Desired base part of the
tarball's filename


targetFile="$targetDir/`date +%Y-%b-%e`.tgz"
echo "Tarring up source into target"
echo " $targetFile"
tar -czvf - --one-file-system $sourceDir | split -b 2000m $targetFile


The script fails with this output:


Tarring up source into target
/TERASTATIONBACKUP/GOSHEN/2008/2008-Jul-10.tgz

split: cannot open `/TERASTATIONBACKUP/GOSHEN/2008/2008-Jul-10.tgz'
for reading: No such file or directory

tar: Removing leading `/' from member names


But, if I comment out the tar line above and replace it with this line:

tar -cvzf - --one-file-system /home | split -b 2000m -
/TERASTATIONBACKUP/GOSHEN/2008/2008-Jul-10.tgz


the script works.

Am I just not seeing a typo somewhere? Why is my script failing?

Thanks!

--
Kent West <*)))><
http://kentwest.blogspot.com


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 07-11-2008, 02:09 AM
"Owen Townend"
 
Default Scripting Question - tar

> > tar -cvzf - --one-file-system /home | split -b 2000m -
> /TERASTATIONBACKUP/GOSHEN/2008/2008-Jul-10.tgz
vs
> > tar -czvf - --one-file-system $sourceDir | split -b 2000m $targetFile

> Am I just not seeing a typo somewhere? Why is my script failing?
>
> Thanks!

Hey,
You're missing the '-' for stdin

tar -czvf - --one-file-system $sourceDir | split -b 2000m - $targetFile



cheers,
Owen.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 07-11-2008, 03:45 AM
Kent West
 
Default Scripting Question - tar

Owen Townend wrote:

Kent West wrote:

Am I just not seeing a typo somewhere? Why is my script failing?




Hey,
You're missing the '-' for stdin

tar -czvf - --one-file-system $sourceDir | split -b 2000m - $targetFile



Ah, thank you!


--
Kent West <")))><
Westing Peacefully - http://kentwest.blogspot.com


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 07-11-2008, 03:25 PM
T o n g
 
Default Scripting Question - tar

On Thu, 10 Jul 2008 17:04:38 -0500, Kent West wrote:

>> tar -cvzf - --one-file-system /home | split -b 2000m -

Side note since the problem has been solved.

You might want to look into dar, which will do splitting for you
automatically, as well as many other desired features for backup
(incremental, has catalog for fast search & restore, and many many
others...).

dar - Disk ARchive: Backup directory tree and files

--
Tong (remove underscore(s) to reply)
http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 

Thread Tools




All times are GMT. The time now is 09:42 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org