I want to run my cron job at 4 AM on every Tuesday between 4th and 24th of every month. Can someone help me with this. It shouldnt run outside the 4-24 range. Inside this range, it should run only on Tuesdays. For example for the month of April 2019, I want my job to run only on 9th, 16th and 23rd. Any help would be much appreciated. The OS is Ubuntu 16.04.4 LTS

1 Answer 1


You can achieve this by using a simple cron job that runs each day on the 4-24th

0 4 4-24 * * /bin/foo

with a condition to test for Tuesday.

[ "$(date '+%a')" = "Tue" ]

Combining this you have:

0 4 4-24 * * [ "$(date '+\%a')" = "Tue" ] && /bin/foo

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.