LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-28-2016, 05:34 AM   #1
akya
LQ Newbie
 
Registered: Nov 2008
Location: India
Distribution: Fedora 25
Posts: 17

Rep: Reputation: 0
tar ignores exclude from file parameter


I created some backup scripts that are added to cronjob. I noticed the size of recent backups was tripled in last few days. (Upgraded to F25) I checked out the scripts manually and found out that tar ignores -X option and whole lot of excluded directories were getting backed up too. Here is the command I was using.

Code:
#!/bin/bash  
TIME=`date +"%Y-%m-%dT%H-%M"`
FILENAME="important-$TIME"
SRC1="/media/Data/Backup"
SRC2="/media/Data/Books"
DST="/run/media/akya/Backup/cron"
EX="/home/akya/scripts/exclude"

tar -cpz $SRC1 $SRC2 -X $EX/imp | gpg --encrypt --recipient akshay > $DST/$FILENAME.tar.gz.gpg   

notify-send 'Backup' 'Finished backing up important stuff from Data' --icon=/home/akya/scripts/backup.png
#END
If I remove the gpg part then the exclude file is taken into consideration while achiving. The above command worked before. Not sure whats exactly wrong here.
 
Old 11-28-2016, 05:55 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,925

Rep: Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320
it looks like $EX is located outside of $SRC1 and $SRC2, so nothing to exclude. But probably I misunderstood something.
 
Old 11-28-2016, 05:58 AM   #3
akya
LQ Newbie
 
Registered: Nov 2008
Location: India
Distribution: Fedora 25
Posts: 17

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by pan64 View Post
it looks like $EX is located outside of $SRC1 and $SRC2, so nothing to exclude. But probably I misunderstood something.
$EX/imp points to the file named imp which has all extensions and paths to be excluded when archiving.
 
Old 11-28-2016, 06:56 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,925

Rep: Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320
so would be nice to see a real example
by the way you can try something like this:
tar ..... | tee file.tar | gpg ...
 
Old 11-28-2016, 10:05 PM   #5
akya
LQ Newbie
 
Registered: Nov 2008
Location: India
Distribution: Fedora 25
Posts: 17

Original Poster
Rep: Reputation: 0
Found out there is a bug in tar 1.29. Downgrading to tar 1.28 helped for now.
 
  


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 command with exclude parameter ajayyadavmca Programming 9 04-25-2012 01:58 PM
[SOLVED] Tar using include-file and exclude file one liner? metallica1973 Linux - Server 5 10-20-2011 02:25 PM
how to tar file with exclude a directory elainelaw Linux - Newbie 1 03-02-2010 10:15 PM
Exclude file types in smbclient tar UltramaticOrange Linux - Networking 1 04-09-2006 04:11 PM
tar --exclude-from=FILE GATTACA Programming 1 07-29-2005 12:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:45 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
Open Source Consulting | Domain Registration