LinuxQuestions.org
Review your favorite Linux distribution.
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-01-2007, 07:08 PM   #1
Robert S
Member
 
Registered: Oct 2006
Location: Canberra
Distribution: gentoo, debian
Posts: 63

Rep: Reputation: 15
What does tar exit code 2 mean


I have a backup script that backs up home directories and /etc. I have got the script to exit if the 'tar' command returns a nonzero code. At random it seems to return a code of 2, but it seems to back up all files.

Could this be due to files being deleted or changed while the tar command is in progress? Should I ignore these errors?
 
Old 11-01-2007, 07:29 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
Tar exit code 2 means "failed read" as far as I am able to determine.

Since you are backing up /home and /etc, I would suggest that there are files/folders in /etc that you as user do have read access to. The failed reads may record the file name, but not the contents.

Try running the script as root to see if the error repeats.

Last edited by bigrigdriver; 11-01-2007 at 07:31 PM.
 
Old 11-01-2007, 07:44 PM   #3
Robert S
Member
 
Registered: Oct 2006
Location: Canberra
Distribution: gentoo, debian
Posts: 63

Original Poster
Rep: Reputation: 15
I am running it as root.

I wonder if files in the maildirs in the home directories are changing while the backup is in progress - hence the error code.
 
Old 04-20-2012, 08:24 PM   #4
ddouble
LQ Newbie
 
Registered: Apr 2012
Posts: 2

Rep: Reputation: Disabled
Document of tar

Document of tar
http://www.gnu.org/software/tar/manu.../Synopsis.html

Possible exit codes of GNU tar are summarized in the following table:

0
‘Successful termination’.

1
‘Some files differ’. If tar was invoked with ‘--compare’ (‘--diff’, ‘-d’) command line option, this means that some files in the archive differ from their disk counterparts (see section Comparing Archive Members with the File System). If tar was given ‘--create’, ‘--append’ or ‘--update’ option, this exit code means that some files were changed while being archived and so the resulting archive does not contain the exact copy of the file set.

2
‘Fatal error’. This means that some fatal, unrecoverable error occurred.
 
Old 04-20-2012, 08:34 PM   #5
abtekk
Member
 
Registered: Aug 2011
Posts: 30

Rep: Reputation: Disabled
Maybe a way to combat this could be having the script COPY the 2 directorys to a temporary directory, then tar up the files, then delete the temp files. Of course this method would require more time and hard drive space, but the principle is there.
 
  


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
Exit Code 204 Tim Johnson Linux - General 5 04-25-2006 01:59 AM
Exit Code: 7 dbzw SUSE / openSUSE 0 12-21-2004 01:06 PM
exit code 2 -- pppd eduac Linux - Software 3 11-21-2003 05:19 AM
pppd exit code = 10 eduac Linux - Hardware 1 10-20-2003 02:57 AM
kppp - exit code 1 grim1234 Slackware 3 09-02-2003 09:01 AM

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

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