Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Cron Expression

  1. #1
    Regular Coder
    Join Date
    Jun 2007
    Location
    N. Ireland
    Posts
    351
    Thanks
    16
    Thanked 4 Times in 4 Posts

    Cron Expression

    I have a script that is to run and 5pm on last day of month.

    I have a little experience with CRON but came across the special character 'L' that can be used in day of month field.

    Does the following look correct:
    0 0 5 L * * [path to script]

    D.
    Last edited by daemonkin; 05-29-2008 at 10:52 AM. Reason: typo
    Daemonkin.
    If this was helpful, please add to my reputation
    Thousand Sons - Freelance Web Developer - ninetyonedegrees.com

  • #2
    Regular Coder
    Join Date
    May 2008
    Location
    Ohio
    Posts
    231
    Thanks
    3
    Thanked 21 Times in 21 Posts
    By looking at http://www.linuxhelp.net/guides/cron/ I would say no. I think your digits might be off.
    The format is:
    Code:
    1	Minute (0-59)
    2	Hour (2-24)
    3	Day of month (1-31)
    4	Month (1-12, Jan, Feb, etc)
    5	Day of week (0-6) 0 = Sunday, 1 = Monday etc or Sun, Mon, etc)
    6	User that the command will run as
    7	Command to execute
    And if you have 0 0 5, that's saying 0th minute of 0th hour on the 5th day of the month.

    Of course, I don't use cron a whole lot, so I could be wrong.
    zok@zoklet:~$ whereis zok
    zok: http://zoklet.net | http://zoklet.net/otg | /derzok/at/gmail/dot/com

  • #3
    New Coder
    Join Date
    Jun 2008
    Posts
    25
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by derzok View Post

    And if you have 0 0 5, that's saying 0th minute of 0th hour on the 5th day of the month.

    Of course, I don't use cron a whole lot, so I could be wrong.
    Nope you are not wrong (unless I am too!). I'm not familiar with using L to represent the last day of the month, but assuming it is correct you would need to do something like:

    0 5 L * * * path/to/script


  •  

    Posting Permissions

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