Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 03-03-2004, 11:14 AM   #1
Registered: Oct 2003
Location: Wyoming
Distribution: Gentoo, Ubuntu, FreeBSD
Posts: 46

Rep: Reputation: 15
cron last day of every month

How would you go about writing a crontab entry for a job that would run at 11:59pm on the last day of every month? It can't be static since the days in a month varies from 28 to 31.

Also, how can you deal with leap years?
Old 03-03-2004, 11:42 AM   #2
LQ Guru
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
The crontab (5) manual page has some details on specifying hours, minutes, and days of the month (type 'man 5 crontab' to see it).

I also found this and this after some searching.

It'd probably be a lot easier to just run it on the 1st of the month at midnight
Old 03-03-2004, 08:41 PM   #3
Senior Member
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 58
Digging around on the web, this is as far as I get. I'm not entirely sure if this will handle the leap year. Would appreciate if you find out to let me know.

#All months with 31 days
59 23 31 1-7/2,8-12/2 * /mnt/backup/backup.job
# All months with 30 days
59 23 30 4,6,9,11 * /mnt/backup/backup.job
#February on a normal year
59 23 28 2 * /mnt/backup/backup.job
#February on a leap year (maybe)
59 23 29 2 5 /mnt/backup/backup.job

Last edited by homey; 03-03-2004 at 11:41 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
transform month number to month name in php ALInux Programming 1 11-09-2005 10:45 AM
What applications do you use day to day? alan_h404 General 11 10-16-2005 07:09 AM
Why not use Astaro as a normal day to day desktop?? chutsu Linux - General 1 10-08-2005 11:42 PM
Multicount in PHP , displays visits on current day, week, month, year and total visit xbaez Programming 1 04-24-2005 02:50 AM
Starting day of month, month length chrisk5527 Programming 2 03-03-2004 04:03 PM

All times are GMT -5. The time now is 09:30 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration