LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   crontab doesn't works (https://www.linuxquestions.org/questions/linux-server-73/crontab-doesnt-works-566583/)

heathcliffz 07-04-2007 09:14 AM

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?

Berhanie 07-04-2007 09:36 AM

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.

heathcliffz 07-04-2007 09:51 AM

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?

Berhanie 07-04-2007 09:59 AM

What's in the tar file?

Brian1 07-04-2007 10:16 AM

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

heathcliffz 07-04-2007 11:27 AM

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...

heathcliffz 07-04-2007 11:28 AM

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...

Berhanie 07-04-2007 01:09 PM

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.

heathcliffz 07-04-2007 01:18 PM

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...

Berhanie 07-05-2007 12:09 AM

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.

heathcliffz 07-05-2007 06:19 AM

this directory have no symbolic links... only dba files and mail attachments...


All times are GMT -5. The time now is 12:15 PM.