I'm trying to have a Azure webjob run hourly, but either the documentation is very confusing or I'm missing something. I'm using a TimerTrigger
with the following signature:
public void RunHourly([TimerTrigger("0 * * * *")] TimerInfo myTimer)
and deployed it in Azure. When I run the webjob in Azure, in the output I see:
[06/24/2021 11:35:32 > 886219: INFO] info: Host.Triggers.Timer[5]
[06/24/2021 11:35:32 > 886219: INFO] The next 5 occurrences of the 'RunHourly' schedule (Cron: '0 * * * *') will be:
[06/24/2021 11:35:32 > 886219: INFO] 06/24/2021 12:00:00Z
[06/24/2021 11:35:32 > 886219: INFO] 06/24/2021 13:00:00Z
[06/24/2021 11:35:32 > 886219: INFO] 06/24/2021 14:00:00Z
[06/24/2021 11:35:32 > 886219: INFO] 06/24/2021 15:00:00Z
[06/24/2021 11:35:32 > 886219: INFO] 06/24/2021 16:00:00Z
so everything looks fine. In the webjob pane of azure portal, the schedule column has a value of n/a since I haven't provided a schedule in settings.job and when I start the webjob manually, I get the following error after some minutes
[06/24/2021 11:41:34 > 886219: ERR ] Command 'cmd /c ""run.exe""' was aborted due to no output nor CPU activity for 121 seconds. You can increase the SCM_COMMAND_IDLE_TIMEOUT app setting (or WEBJOBS_IDLE_TIMEOUT if this is a WebJob) if needed.
cmd /c ""run.exe""
[06/24/2021 11:41:35 > 886219: SYS INFO] Status changed to Failed
[06/24/2021 11:41:35 > 886219: SYS ERR ] System.AggregateException: One or more errors occurred. ---> Kudu.Core.Infrastructure.CommandLineException: Command 'cmd /c ""run.exe""' was aborted due to no output nor CPU activity for 121 seconds. You can increase the SCM_COMMAND_IDLE_TIMEOUT app setting (or WEBJOBS_IDLE_TIMEOUT if this is a WebJob) if needed.
So my question is how I'm supposed to use the TimerTrigger to have a method run every hour or every day? Do I need to have a schedule as well (kind of defeats the purpose of TimerTrigger)?
Any help is appreciated