Hello, all! I have a backup script that is puzzling me. When I run it manually from the command line (as root) it quite happily goes off and makes a nice tarball of specified directories and plops it as a dated file of some 50Meg into a samba-mounted directory on the main ntserver, so it can be grabbed by the backup tape running from there. However, when i set it as a cron task (for root) it only makes a tiny little file, every single time. I thought it may be a samba share problem so i set it to back up to a linux directory and then copy it over, but it still only makes this tiny file. Contents of the back-up file: the weekend ones were the ones scheduled to run by cron, and the big one one where I ran it a moment ago from the command line. -rwxr-xr-x 1 root root 14211 Mar 9 22:00 trx-090302.tgz -rwxr-xr-x 1 root root 14211 Mar 10 22:00 trx-100302.tgz -rwxr-xr-x 1 root root 49334571 Mar 11 11:29 trx-110302.tgz
And here is my backup script (please don't laugh at it though!): #!/bin/bash
OF=/backup/trx-$(date +%d%m%y).tgz tar -cvzf $OF /var/www/ /home/cvs
And finally what i have set crontab for root for: 0 22 * * * /root/trxbackup
Can anyone see anything daft I've done? Thanks, Jenny.
Hi Jenny,
On 11-Mar-02 Jenny_Hopkins@toby-churchill.com wrote:
However, when i set it as a cron task (for root) it only makes a tiny little file, every single time. I thought it may be a samba share problem so i set it to back up to a linux directory and then copy it over, but it still only makes this tiny file. Contents of the back-up file: the weekend ones were the ones scheduled to run by cron, and the big one one where I ran it a moment ago from the command line. -rwxr-xr-x 1 root root 14211 Mar 9 22:00 trx-090302.tgz -rwxr-xr-x 1 root root 14211 Mar 10 22:00 trx-100302.tgz -rwxr-xr-x 1 root root 49334571 Mar 11 11:29 trx-110302.tgz
And here is my backup script (please don't laugh at it though!): #!/bin/bash
OF=/backup/trx-$(date +%d%m%y).tgz tar -cvzf $OF /var/www/ /home/cvs
And finally what i have set crontab for root for: 0 22 * * * /root/trxbackup
Can anyone see anything daft I've done?
Nothing obvious. It's worth bearing in mind that cron jobs may not use the same environment as command-line jobs, though I can't see why that should matter here.
However, one thing I do notice is that the two small files are of the same size, suggesting that exactly the same stuff is being archived in each (whatever it may be).
You may, therefore, get a clue by have a look at what's inside.
Try, in the first place,
tar tzvf trx-090302.tgz tar tzvf trx-100302.tgz
and compare it with what it should be.
Hope this helps, Ted.
-------------------------------------------------------------------- E-Mail: (Ted Harding) Ted.Harding@nessie.mcc.ac.uk Fax-to-email: +44 (0)870 167 1972 Date: 11-Mar-02 Time: 12:24:18 ------------------------------ XFMail ------------------------------
On Mon, Mar 11, 2002 at 04:49:22PM +0000, wbh wrote:
OF=/backup/trx-$(date +%d%m%y).tgz tar -cvzf $OF /var/www/ /home/cvs
^
Just a thought, in a cron job, where does stdout go and can it fill up???
Usually defaults to /var/log/messages. Maybe you'll see an error there. You might want to change it to:
tar -cvzf $OF /var/www/ /home/cvs > /tmp/some_logfile 2>&1