6

I am attempting to test my cron job by setting it a few minutes (let's say 10) from the current time. For instance, if right now is 5:00 PM, I set:

10 17 * * * dotnet <full path to .net core dll>

When the clock strikes 5:10 PM, the job is not executed.

On the other hand, if I set the cron job to execute every minute:

* * * * * dotnet <full path to .net core dll>

It is successfully executed every minute.

I've looked up reasons for why a bash command doesn't execute. Unfortunately none of the suggestions explain why one works and the other one does not.

OS: Ubuntu AWS Instance Note: the date command gives me the correct time I am using as a reference.

  • I have tried to reproduce this issue in an Ubuntu aws instance I have access to, but cron just works. 28 15 * * * ubuntu touch /home/ubuntu/test.txt worked with no problems. Do you get cron-mail alerts in dotnet user mail spool? – Bruno9779 Jan 2 '17 at 15:29
1

Have you checked your timezone? Cron runs using local system time, so if, for instance, your system is running on UTC time but you have a TZ environment variable that's adjusting your user time, your crontab will still be executing in UTC time.

Suggested test:

Set it to execute at

10 * * * *

so it will execute in a few minutes regardless of the hour. If it works, then the most likely issue is a timezone offset making the hour you specified not the hour you meant to specify :)

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.