Results 1 to 5 of 5

Thread: cron and tar problem

  1. #1
    Join Date
    Jul 2010
    Location
    NSW, Australia
    Beans
    133
    Distro
    Xubuntu 13.10 Saucy Salamander

    cron and tar problem

    Greetings Enlightened Folks!!

    I have a script - called 'backit' - to back up files to a tarball - listed below (<backup.lst> contains files I want backed up)

    #!/bin/bash
    # 22/7/2010
    # Backup important files
    cd ~
    tar cvfz .backup/backup.tar.gz -T .backup/backup.lst
    cp .backup/backup.tar.gz /media/Archive/.backup


    Typing 'Backit' in the shell works very well producing a backup file, <backup.tar.gz>, of 2 298 953 bytes and contains all the correct files.

    So far, so good!

    I put a line in crontab -

    0 * * * * /home/alan/bin/backit

    The program runs every hour on the hour and produces the <backup.tar.gz> file. However, this file contains only some of the files and has a size of 76 762 bytes. Using "tar tvf backup.tar.gz" lists some of the files and ends with an error indicating an EOF encountered before the end of file.

    If the script executes correctly when typed into the shell, why does it not run to completion correctly when run by cron?

    Thanks for you help.

    Alan.

  2. #2
    Join Date
    Jul 2009
    Location
    London
    Beans
    1,480
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: cron and tar problem

    Hi,
    see http://georgia.ubuntuforums.org/show...00&postcount=6
    You have 2 choices, either remove the verbose flag (v) from your tar options, or put MAILTO="" at the top of your crontab.

  3. #3
    Join Date
    Jul 2010
    Location
    NSW, Australia
    Beans
    133
    Distro
    Xubuntu 13.10 Saucy Salamander

    Re: cron and tar problem

    DaithiF

    Thank you for your very quick reply

    I removed the Verbose option and the process works fine now

    Thank you

    Alan
    Last edited by Alan.Brown; July 23rd, 2010 at 11:47 AM.

  4. #4
    Join Date
    Jul 2009
    Location
    London
    Beans
    1,480
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: cron and tar problem

    Hi, no problem, & welcome to the forums. To mark a thread as solved, click on Thread Tools -> Mark thread as solved

    cheers

  5. #5
    Join Date
    Jul 2010
    Location
    NSW, Australia
    Beans
    133
    Distro
    Xubuntu 13.10 Saucy Salamander

    Re: cron and tar problem

    Thanks!! I just found it

    Alan

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •