Results 1 to 5 of 5

Thread: Cron job between every 10 minutes 8am and 2am

  1. #1
    Join Date
    Aug 2012
    Beans
    24

    Question Cron job between every 10 minutes 8am and 2am

    Hi,

    I'm trying to create a cron job that runs every 10 minutes between 8am and 2am the following day but cant work out how to do it.

    I tried

    */10 8-2 * * * scriptname

    which didn't seem to run at all even though it installed without error.

    So i tried creating 2 jobs but it didn't start again this morning
    */10 8-0 * * * scriptname
    */10 0-2 * * * scriptname

    any idea how I can achieve this?

    I'm using ubuntu 12.04 64bit.

    Thanks.

  2. #2
    Join Date
    Jul 2010
    Location
    London
    Beans
    508
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Cron job between every 10 minutes 8am and 2am

    Try this:

    */10 0-2,8-23 * * *

    ...or:

    */10 0,1,2,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,2 3 * * *

  3. #3
    wojox is offline I Ubuntu, Therefore, I Am
    Join Date
    Apr 2009
    Beans
    8,630

    Re: Cron job between every 10 minutes 8am and 2am

    Where is the script located? Are you using the proper path?

  4. #4
    Join Date
    Jul 2010
    Location
    London
    Beans
    508
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Cron job between every 10 minutes 8am and 2am

    Good point, you should first make sure that cron is able to run the script at all before you start messing with the timings. When you run it via normal user session there are many environment variables available which are not necessarily available during a cron job.

  5. #5
    Join Date
    Aug 2012
    Beans
    24

    Re: Cron job between every 10 minutes 8am and 2am

    Quote Originally Posted by jim_deadlock View Post
    Try this:

    */10 0-2,8-23 * * *
    Your a legend worked a treat thanks!

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
  •