how to execute a command on the first, second, third and fourth Sunday of the month with crontab [duplicate]
The first Sunday will always fall between the 1st and the 7th so
10 1 1-7 * * test `date +\%a` == "Sun" && doSomething
will run doSomething at 10 past 1 on a Sunday that falls between the 1st and the 7th. Similarly the second Sunday will fall between the 8th and 14th, the third between 15th and 21st and the 4th between 22rd and 28th so adjust the day of month accordingly on the relevant server.
Note that the test is required because
Note: The day of a command's execution can be specified by two fields -- day of month, and day of week. If both fields are restricted (ie, aren't *), the command will be run when either field matches the cur- rent time. For example, "30 4 1,15 * 5" would cause a command to be run at 4:30 am on the 1st and 15th of each month, plus every Friday.