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 03-16-2010, 02:54 AM   #1
toredo
Member
 
Registered: Feb 2009
Posts: 83

Rep: Reputation: 25
tar problems in a cron job


hello,

i have some cron-jobs to make small backups with tar. if i test them manually, they run perfectly everytime. but if the cron job starts it don't works. the created archive is to small, and if i type "tar tvf filename" i will see some files in the archive and then:
"tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now"

Has someone an idea? :-S

best regards
toredo

Last edited by pixellany; 03-16-2010 at 07:12 AM. Reason: better title
 
Old 03-16-2010, 03:20 AM   #2
raju.mopidevi
Senior Member
 
Registered: Jan 2009
Location: vijayawada, India
Distribution: openSUSE 11.2, Ubuntu 9.0.4
Posts: 1,155
Blog Entries: 12

Rep: Reputation: 92
To backup our files you can use "cpio"
 
Old 03-16-2010, 03:33 AM   #3
timvandijk039
Member
 
Registered: Jul 2009
Location: The Netherlands
Distribution: Debian/Ubuntu and RHEL/CentOS
Posts: 42

Rep: Reputation: 18
Hi Toredo,

here are some thoughts...

1. Are the files accessible from the specified cron user? Eg. correct file- and directory permissions; Is the file system mounted and accessible for the cron user?

2. How big is the tar-file and what type of file system are you using? Some file systems have a pretty low file size limit. Eg: FAT16 has a file size limit of 2GB and FAT32 has it's limit at 4GB.

3. What is the output of:
Code:
ulimit -a
(You might be hitting the limit of the maximum open file handle count)

Hope this helps.

Best regards,
Tim
 
Old 03-16-2010, 03:46 AM   #4
lupusarcanus
Senior Member
 
Registered: Mar 2009
Location: USA
Distribution: Arch
Posts: 1,022
Blog Entries: 19

Rep: Reputation: 146Reputation: 146
Hello toredo,

Your title is rather indefinite and doesn't provide an accurate synopsis of the problem. A descriptive title is always beneficial in the long run; it helps you get more relevant replies faster and it allows other users to find it with the search function. Your description is OK, but it would improve the readability of your post if you chose to use correct spelling, punctuation and grammar. Please see this tutorial for more details.

By the very nature of the error, one would assume that the file in question may be corrupt, or it is not really compressed. Wikipedia provides proof of this concept. Use:-
Code:
file /path/to/file
to check the status of the file. This will be beneficial in your diagnosis.

Remember that a simple Google search often will yield some insight to any particular problem.

Last edited by lupusarcanus; 03-16-2010 at 03:47 AM.
 
Old 03-16-2010, 03:47 AM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Redirect the output of stderr to a file. Study the output for error messages. Writes to stdout or reads from stdin will be blocked in a cron job which could account for a partially complete archive. Make sure you define any environmental variables and PATH entries you need. Also post your cron job. More eyeballs may be able to spot something you missed.

Last edited by jschiwal; 03-16-2010 at 03:49 AM.
 
Old 03-16-2010, 04:58 AM   #6
toredo
Member
 
Registered: Feb 2009
Posts: 83

Original Poster
Rep: Reputation: 25
Quote:
Originally Posted by raju.mopidevi View Post
To backup our files you can use "cpio"
thx, i'll search it.

Quote:
Originally Posted by timvandijk039 View Post
Hi Toredo,

here are some thoughts...

1. Are the files accessible from the specified cron user? Eg. correct file- and directory permissions; Is the file system mounted and accessible for the cron user?

2. How big is the tar-file and what type of file system are you using? Some file systems have a pretty low file size limit. Eg: FAT16 has a file size limit of 2GB and FAT32 has it's limit at 4GB.

3. What is the output of:
Code:
ulimit -a
(You might be hitting the limit of the maximum open file handle count)

Hope this helps.

Best regards,
Tim
thx for the help, here the answers

1)the last times i tried to run it as root, but there was the same error.

2)the resulting file is ~30mb, the source and the target filesystems are both ext3.

3)this is the output from "ulimit -a":
Code:
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 479
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 479
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
Quote:
Originally Posted by leopard View Post
Hello toredo,

Your title is rather indefinite and doesn't provide an accurate synopsis of the problem. A descriptive title is always beneficial in the long run; it helps you get more relevant replies faster and it allows other users to find it with the search function. Your description is OK, but it would improve the readability of your post if you chose to use correct spelling, punctuation and grammar. Please see this tutorial for more details.

By the very nature of the error, one would assume that the file in question may be corrupt, or it is not really compressed. Wikipedia provides proof of this concept. Use:-
Code:
file /path/to/file
to check the status of the file. This will be beneficial in your diagnosis.

Remember that a simple Google search often will yield some insight to any particular problem.
thx for the answer, i'll try to write a better english, but it's not my native language and i'm not very good in english, so i have problems to write a good text. but i'll try it:-)

ok, i used the file-command:
Code:
10-03-16.tar.bz: bzip2 compressed data, block size = 900k
i tried it with a corrupted and a normaly archive, both gave the same output.

ok, i use the google-link to search again. i already searched, but may be i used the wrong key words.

Quote:
Originally Posted by jschiwal View Post
Redirect the output of stderr to a file. Study the output for error messages. Writes to stdout or reads from stdin will be blocked in a cron job which could account for a partially complete archive. Make sure you define any environmental variables and PATH entries you need. Also post your cron job. More eyeballs may be able to spot something you missed.
ok, good idea, i'll change the job and write the stderr to a file.

20 3 * * * root /root/scripts/backup.sh /home/vss vss 20

backup.sh creates a backup archive on a defined path. the number on the right means the maximal number of backup-archives for "/home/vss".

best regards
toredo
 
Old 03-16-2010, 05:04 AM   #7
lupusarcanus
Senior Member
 
Registered: Mar 2009
Location: USA
Distribution: Arch
Posts: 1,022
Blog Entries: 19

Rep: Reputation: 146Reputation: 146
Hello again toredo,

Have you tried the command:-
Quote:
tar xvjf filename
Does that result in the same error?
 
  


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
i dont know how to install tar.gz files on my linux. Josiah26 Linux - Newbie 8 04-23-2008 05:26 AM
BackUp & Restore with TAR (.tar / .tar.gz / .tar.bz2 / tar.Z) asgarcymed Linux - General 5 12-31-2006 02:53 AM
Yum that dont work Tinochelli Linux - Software 1 01-26-2005 05:10 PM
Things dont work when you dont understand withoutaclue Linux - Newbie 3 03-12-2003 09:51 AM

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

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