LinuxQuestions.org
Register a domain and help support LQ
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 07-04-2007, 09:14 AM   #1
heathcliffz
LQ Newbie
 
Registered: Jul 2007
Location: Brazil
Distribution: Ubuntu / Fedora 7
Posts: 8

Rep: Reputation: 0
crontab doesn't works


hi everyone...
my crontab is configured to make backup of some stuff with TAR and send it to other pc with SCP... there are 2 pcs with the same problem and different backup scripts... the problem is... when the crond stars to create the tar.gz file with the backup it creates a file with 148kb and the backup have 997mb... the permissions are OK...
I created a script:
#!/bin/sh
ls -laht > /root/resul_teste

script permissions:
-rwxr-xr-x 1 root root 39 Jul 3 13:51 teste.sh
crontab:
53 13 * * * /root/teste.sh
and it works fine...
but the backup script... nothing:
crontab:
30 12,21 * * * root /root/backup-www.sh
backup script:
#!/bin/sh
cd /bkp/
a=http-`date +%d%m%Y%H%M`
echo "Entrei-Backup-fontes-http"-$a >> /var/log/bkp_bancos
/bin/tar cvzf /bkp/$a.tar.gz /var/www/html/
scp /bkp/$a.tar.gz root@192.168.2.5:/bkp/192.168.1.2
echo "backup-fontes"-$a >> /var/log/bkp_bancos


answers?
 
Old 07-04-2007, 09:36 AM   #2
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
This is the syntax for a user cron:
Code:
53 13 * * * /root/teste.sh
This is the syntax for the system cron
Code:
30 12,21 * * * root /root/backup-www.sh
Note that the system cron has an extra field for the user which runs the script. The system crontab is /etc/crontab. Also, check your paths. In particular, tar may be in /usr/bin/ instead /bin. Finally, error messages will be mailed to you, so check root's mailbox.
 
Old 07-04-2007, 09:51 AM   #3
heathcliffz
LQ Newbie
 
Registered: Jul 2007
Location: Brazil
Distribution: Ubuntu / Fedora 7
Posts: 8

Original Poster
Rep: Reputation: 0
the paths are OK... the tar path too... 'cause it creates a file .tar.gz but the size is 148k instead of 997mb (real size). I'm sure of it cause when I executed the script it worker pretty well... (i'm doing it every day)... i'm putting the backup command on /etc/crontab so... the syntax is correct, isn't it?
 
Old 07-04-2007, 09:59 AM   #4
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
What's in the tar file?

Last edited by Berhanie; 07-04-2007 at 10:01 AM.
 
Old 07-04-2007, 10:16 AM   #5
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 61
Checked your other post and you mention using Fedora. Is this the distro you are asking the question about? If so then maybe you could place your script in one of the /etc/cron.daily subdirectory or other related depending on when you want it to run. See it works that way.

Brian
 
Old 07-04-2007, 11:27 AM   #6
heathcliffz
LQ Newbie
 
Registered: Jul 2007
Location: Brazil
Distribution: Ubuntu / Fedora 7
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Brian1
Checked your other post and you mention using Fedora. Is this the distro you are asking the question about? If so then maybe you could place your script in one of the /etc/cron.daily subdirectory or other related depending on when you want it to run. See it works that way.
hey Brian... i'm gonna test it but i think that even if it works i won't use it cause the backups must be made 2 times every day and must be at: 01:00 PM and 9:00 PM...
 
Old 07-04-2007, 11:28 AM   #7
heathcliffz
LQ Newbie
 
Registered: Jul 2007
Location: Brazil
Distribution: Ubuntu / Fedora 7
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Berhanie
What's in the tar file?
Berhanie the tar files have a backup of the e-mails. This pc have a e-mail server...
 
Old 07-04-2007, 01:09 PM   #8
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
I mean, if you can't find any useful error messages, then you might be able to diagnose the problem based on what got tarred -- i.e. untar the thing (or, do a 'tar tzf') and see what's in it.
 
Old 07-04-2007, 01:18 PM   #9
heathcliffz
LQ Newbie
 
Registered: Jul 2007
Location: Brazil
Distribution: Ubuntu / Fedora 7
Posts: 8

Original Poster
Rep: Reputation: 0
ok... inside the incomplete tar... it's like it started compacting and something cancels... than the file is incomplete... but inside it there's some files from the folder i wanted to compact...
 
Old 07-05-2007, 12:09 AM   #10
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
If this is not an error, then it possibly has to do with dereferencing symbolic links. When you computed the size of the directory, you might have dereferenced the links, while tar doesn't derefernce links (by default), making it appear as if there is a size discrepancy between the tar file and the original directory.

Last edited by Berhanie; 07-05-2007 at 12:10 AM.
 
Old 07-05-2007, 06:19 AM   #11
heathcliffz
LQ Newbie
 
Registered: Jul 2007
Location: Brazil
Distribution: Ubuntu / Fedora 7
Posts: 8

Original Poster
Rep: Reputation: 0
this directory have no symbolic links... only dba files and mail attachments...
 
  


Reply

Tags
backup, crontab, fedora, tar


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Shell pgm works fine in command line but not in Crontab oracledba_raja Linux - General 2 11-24-2006 12:14 AM
XAWTV works, videodog works, motion works but how to code my own? rylan76 Linux - Hardware 0 01-06-2006 06:30 AM
shell script works form command line but not form crontab saifee General 1 10-14-2004 10:27 AM
crontab doesnt works with all jobs. pxes351 Linux - Newbie 2 05-10-2004 01:11 AM
system-wide crontab in /etc/crontab ner Linux - General 2 11-18-2003 12:35 PM


All times are GMT -5. The time now is 03:18 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration