Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: How to setup cron?

  1. #11
    Join Date
    Oct 2006
    Beans
    327
    Distro
    Kubuntu 7.04 Feisty Fawn

    Re: How to setup cron?

    Here's the contents of the log file when I set cron up to run the script:

    Code:
    Script started on 05/12/09 at 15:33:01
    -----------------------------------------------------------------------------
    Backing up the webpage...
    Backup fails!
    Copying backup to /home/chair/backups...
    Status: Fail!
    Copying backup to /data/backups on second hard drive...
    Status: Fail!
    Here's the contents when I run the script manually:

    Code:
    Script started on 05/12/09 at 15:37:04
    -----------------------------------------------------------------------------
    Backing up the webpage...
    Backup complete!
    Copying backup to /home/chair/backups...
    Status: ok!
    Copying backup to /data/backups on second hard drive...
    Status: ok!

  2. #12
    Join Date
    Apr 2009
    Beans
    Hidden!
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: How to setup cron?

    Man.. I'm out of suggestions!

    It looks to be a permission issue, but you already told me that you're executing and scheduling the script with the same user!

    The problem is that these commands don't have an error code table (only 0 for success and 1 for error!), so it's kind of hard to debug...

    Well, I don't know if it's against the forum rulles, but you could consider to schedule the script with root account.. IF it's a permission problem, it won't show any error message!

    I don't know!

    Any ideas are welcome!

  3. #13
    Join Date
    Oct 2006
    Beans
    327
    Distro
    Kubuntu 7.04 Feisty Fawn

    Re: How to setup cron?

    Running the script with sudo produces no errors. Putting it in sudo crontab -e and letting cron run it produces this in the log:

    Code:
    Script started on 05/12/09 at 17:19:01
    -----------------------------------------------------------------------------
    Backing up the webpage...
    Backup fails!
    Copying backup to /data/backups on second hard drive...
    Status: ok!
    Copying backup to /home/chair/backups...
    Status: ok!
    What happened was the backup created a 0kb file with the correct name but produced an error and then propagating that backup to the two locations both succeeded because they just moved the 0 kb file... now I'm really confused.

  4. #14
    Join Date
    Apr 2009
    Beans
    Hidden!
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: How to setup cron?

    Hi Jarn!

    I don't know how the `curl` command works (or what it do), but if it isn't running as root, something is wrong!

    Do some tests running the command with 'sudo' and see with is there any error messages...

  5. #15
    Join Date
    Oct 2006
    Beans
    327
    Distro
    Kubuntu 7.04 Feisty Fawn

    Re: How to setup cron?

    The script runs fine when running as root via sudo (i.e. "sudo <path to script>" performs the backup fine). It doesn't run fine when run as root via cron (i.e. putting <path to script> in "sudo crontab -e" produces the output listed above).

Page 2 of 2 FirstFirst 12

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
  •