Results 1 to 5 of 5

Thread: Bi-Weekly Cron

  1. #1
    Join Date
    Jun 2005
    Location
    Ohio, USA
    Posts
    208

    Arrow Bi-Weekly Cron

    Anyone know how to get a cron to run twice a week? I want this email script to send out the same email twice a week, but am not sure which cron settings I should use.
    NuPixel - Custom Web Design & Graphics
    Extraordinary, Not Ordinary
    Web & Graphic Design, HTML, XHTML, CSS, Script Customization & Integration + More!
    Click Today! --> NuPixelStudios.com

  2. #2
    Join Date
    Sep 2007
    Posts
    368

    *

    Quote Originally Posted by NuPixel View Post
    Anyone know how to get a cron to run twice a week? I want this email script to send out the same email twice a week, but am not sure which cron settings I should use.

    Hello sir,

    cron have format like that, please check it accordingly.

    minute hour day month dayofweek command

    * minute any integer from 0 to 59
    * hour any integer from 0 to 23
    * day any integer from 1 to 31 (must be a valid day if a month is specified)
    * month any integer from 1 to 12 (or the short name of the month such as jan, feb, and so on)
    * dayofweek any integer from 0 to 7 where 0 or 7 represents Sunday (or the short name of the week such as sun, mon, and so on)
    * command the command to execute. The command can either be a command such as ls /proc >> /tmp/proc or the command to execute a custom script that you wrote.


    For any of the above values, an asterisk (*) can be used to specify all valid values. For example, an asterisk for the month value means execute the command every month within the constraints of the other values.

    A hyphen (-) between integers specifies a range of integers. For example, 1-4 means the integers 1, 2, 3, and 4.

    A list of values separated by commas (,) specifies a list. For example, 3, 4, 6, 8 indicates those four specific integers.

    The forward slash (/) can be used to specify step values. The value of an integer can be skipped within a range by following the range with /<integer>. For example, 0-59/2 can be used to define every other minute in the minute field. Step values can also be used with an asterisk. For instance, the value */3 can be used in the month field to run the task every third month.

    Any lines that begin with a hash mark (#) are comments and are not processed.

    Examples of crontabs

    # record the memory usage of the system every monday
    # at 3:30AM in the file /tmp/meminfo
    30 3 * * mon cat /proc/meminfo >> /tmp/meminfo
    # run custom script the first day of every month at 4:10AM
    10 4 1 * * /root/scripts/backup.sh

  3. #3
    Join Date
    Jun 2005
    Location
    Ohio, USA
    Posts
    208
    Okay cool, so basically for this I just set the script to run on two different days of the week..? Sounds simple enough.
    NuPixel - Custom Web Design & Graphics
    Extraordinary, Not Ordinary
    Web & Graphic Design, HTML, XHTML, CSS, Script Customization & Integration + More!
    Click Today! --> NuPixelStudios.com

  4. #4
    Join Date
    Sep 2007
    Posts
    368

  5. #5
    Join Date
    Jul 2009
    Posts
    240
    * * */8 * * /my/script.sh #run 8 times a month

Posting Permissions

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