Results 1 to 5 of 5

Thread: /etc/cron

  1. #1
    Join Date
    Jan 2005
    Posts
    2,175

    Question /etc/cron

    If I want this rsync script to run at 2AM daily, is this the correct way of adding the following line to /etc/crontab

    0 2 * * * root sh /usr/local/bin/rsync.sh

    thanks.

  2. #2
    Join Date
    Jun 2005
    Location
    New Zealand
    Posts
    11
    Yes, Correct.

    You may want to add this to the end of the line to throw all the scripts output away (otherwise it is emailed to you):

    > /dev/null 2>&1

    or

    > /var/log/script.log

    to grab it's output to a file.

  3. #3
    Join Date
    Jan 2005
    Posts
    2,175
    What do you mean by that? I don't get emails from that script. The only email I get daily is the Logwatch.

  4. #4
    Join Date
    Jun 2005
    Location
    New Zealand
    Posts
    11
    With no ending the output from your sync script will get emailed to you each time it runs. If you want that then fine.

    If you don't want that then you can either log the output or throw it away depending what one of my options you choose.

  5. #5
    Join Date
    Apr 2003
    Location
    San Jose, CA.
    Posts
    1,622
    "sh /usr/local/bin/rsync.sh" is repetitive.
    You're forking an extra shell you don't need to...

    (Assuming rsync.sh contains a valid interpreter declaration, i.e.:
    #!/bin/sh
    on the first line and has execute permission for root.)

    0 2 * * * root /usr/local/bin/rsync.sh

Posting Permissions

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