I'm currently writing an article on cron aimed at people who are familiar with the tool, but don't necessarily use it often. I want the examples to be compatible with most common Unix desktops in use (post 2002 linux, bsd, osx).
While looking for a cron expression for "last day of the month", most recommendations that I found suggest to use a combination of a cron expression that would run from the 28 to the 31 of each month combined with a command that includes a boolean date comparison.
TODAY=`date +%m` # Computes the month for today (01-12) TOMORROW=`date --date=tomorrow +%m` # Computes the month for tomorrow (01-12) 0 0 28-31 * * [$TODAY -lt $TOMORROW] && command
This seems to be a popular Unix trick. I recently stumbled upon this wikipedia article on Cron Expressions that discusses some characters that I haven't seen mentioned anywhere else, not even the man pages. According to the article, the L character can be used in an expression to specify the last day of the month (or of the week).
Which version of cron supports this? how widely supported is it? why is it so little known?