hi there
i use 3 13 1-7 * 5 in cron jobs to run my command at first friday of each month,
but i see that the command run on days 1 - 7 and also all fri day!
then i found below note in wikipedia:

if both "day of month" and "day of week" are restricted (not "*"), then either the "day of month" field (3) or the "day of week" field (5) must match the current day.

so, how i can solve the problem?

asked 04 Oct '12, 11:03

www_9px_ir's gravatar image

www_9px_ir
1112
accept rate: 0%




The crontab(5) man page gives the answer in the example at the end.

3 13 1-7 * * test $(date +%u) -eq 5 && your_command

This will run on the first 7 days of the month, but will only proceed to the command if the date says its a Friday.

link

answered 21 Oct '12, 14:01

akc42's gravatar image

akc42
112
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×90
×7

Asked: 04 Oct '12, 11:03

Seen: 2,657 times

Last updated: 21 Oct '12, 14:01

powered by OSQA