1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Hoiw to set up a cron in cpanel to run only on week days, from 7 am to 7 pm?

Discussion in 'General Programming Chat' started by Viltedali, Oct 10, 2012.

  1. Viltedali

    Viltedali Regular Member

    Joined:
    Feb 10, 2008
    Messages:
    305
    Likes Received:
    32
    Location:
    Midwest-US
    As the title says, looking to set up a cron in cpanel to run every 3 minutes only on week days, from 7 am to 7 pm.

    Would this be correct:?

    */3 7-19 * * 1-5


    Thanks in advance for any replies.
     
  2. cgimaster

    cgimaster Power Member

    Joined:
    Jun 30, 2012
    Messages:
    525
    Likes Received:
    311
    Gender:
    Male
    Code:
    */3 7-19 * * 1-5 /path_to_script
    Yes, the */ is pretty much the same of having

    Code:
    3,6,9,12,15,18,21,24,27,30...
     
    • Thanks Thanks x 1
  3. Viltedali

    Viltedali Regular Member

    Joined:
    Feb 10, 2008
    Messages:
    305
    Likes Received:
    32
    Location:
    Midwest-US
    The part I'm not sure about is the setting to make it run from 7 am to 7 pm, would 7-19 be correct for the hour setting?
     
  4. cgimaster

    cgimaster Power Member

    Joined:
    Jun 30, 2012
    Messages:
    525
    Likes Received:
    311
    Gender:
    Male
    Yes, that is correct.

    The dash means range, so you are setting the range of 7am to 7pm.
     
    • Thanks Thanks x 1