Find the answer to your Linux question:
Results 1 to 5 of 5
I have the following line in crontab: Code: 0 0,6,12,18 * * * * /usr/home/userid/script.sh > /usr/home/userid/script.log This script does a curl on a webpage and writes it to disk ...
  1. #1
    Linux User
    Join Date
    Dec 2004
    Posts
    323

    Need help with setting up crontab in FreeBSD

    I have the following line in crontab:
    Code:
    0 0,6,12,18 * * * * /usr/home/userid/script.sh > /usr/home/userid/script.log
    This script does a curl on a webpage and writes it to disk by appending a timestamp to the filename. If I look in the /var/log/cron however, it appears that this cron job has never run. The only way to invoke the script.sh script is manually.
    Is there a reason why this cron job does not run? Could it be a permissioning issue?

  2. #2
    Linux Newbie objuan's Avatar
    Join Date
    Jul 2006
    Location
    california
    Posts
    218
    Hello
    Your syntax looks right for the cron. Here is a quick test you can add to your crontab to see if it is working. First make a dir called test in /home
    */5 * * * * /bin/date >> /home/test/date

    if the cron runs this test but not your syntax it is probilly a permissions
    problem. Then just add your syntax to the root crontab and run it from there.

    Hope this helps you out

  3. #3
    Linux User
    Join Date
    Dec 2004
    Posts
    323
    Thanks, that worked:
    - script.sh does not work from the crontab, only through a manual invoke does it work
    - date cron does work as intended.

    So that means the permissioning issue remains? What do you mean by "Then just add your syntax to the root crontab and run it from there." ?

    Thanks in advance

  4. #4
    Linux Newbie objuan's Avatar
    Join Date
    Jul 2006
    Location
    california
    Posts
    218
    There is a users crontab and a root user crontab
    at the command line type su
    password for root , then as root type crontab -e

  5. #5
    Linux User
    Join Date
    Dec 2004
    Posts
    323
    Thanks again for your response. The crontab is set up for root only and contains both statements:
    Code:
    0 0,6,12,18 * * * * /usr/home/userid/script.sh > /usr/home/userid/script.log
    */5 * * * * /bin/date > /home/test/date
    The file script.sh has rights as follows: -rwxr-xr-x
    which I think should suffice.

    What else could be wrong?

Posting Permissions

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