# addCronJob error

**URL:** <https://forum.servoy.com/t/addcronjob-error/3571>\
**Category:** Classic Servoy\
**Created:** [January 30, 2005, 4:20pm UTC](https://forum.servoy.com/t/addcronjob-error/3571 "2005-01-30T16:20:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Morley](https://avatars.discourse-cdn.com/v4/letter/m/7cd45c/32.png) [@Morley](https://forum.servoy.com/u/Morley)\
**Post date:** [January 30, 2005, 4:20pm UTC](https://forum.servoy.com/t/addcronjob-error/3571/1 "2005-01-30T16:20:12Z")

</div>

I’ve added the following to the solution’s startup script:

```auto
// schedule daily update at 12:20am with no expiry
plugins.scheduler.addCronJob('12:20am','0 20 0 ? * ?',globals.dailyUpdate());

```

I then closed the solution and reopened it. It got the following error message:

> Can’t find method  
> com.servoy.r2.plugins.scheduler.SchedulerProvider.js\_addCronJob(string,string,undefinded)

The globals method “dailyUpdate()” is clearly present and I’m able to manually trigger it.

If I remove the “addCronJob” instruction from the startup script, close the solution, then re-open it, the error doesn’t trigger.

Puzzled.

---

<div class="post-metadata">

**Author:** ![automazione](https://avatars.discourse-cdn.com/v4/letter/a/8797f3/32.png) [@automazione](https://forum.servoy.com/u/automazione)\
**Post date:** [January 30, 2005, 9:20pm UTC](https://forum.servoy.com/t/addcronjob-error/3571/2 "2005-01-30T21:20:18Z")

</div>

Try with:

plugins.scheduler.addCronJob(‘12:20am’,‘0 20 0 ? \* ?’,dailyUpdate);

as reported in the “move sample” of the scheduler

---

<div class="post-metadata">

**Author:** ![Morley](https://avatars.discourse-cdn.com/v4/letter/m/7cd45c/32.png) [@Morley](https://forum.servoy.com/u/Morley)\
**Post date:** [January 30, 2005, 11:47pm UTC](https://forum.servoy.com/t/addcronjob-error/3571/3 "2005-01-30T23:47:50Z")

</div>

> automazione:  
> Try with:
> 
> plugins.scheduler.addCronJob(‘12:20am’,‘0 20 0 ? \* ?’,dailyUpdate);
> 
> as reported in the “move sample” of the scheduler

That seems to catch it. I was caught off guard by the unexpected syntax for calling a global method.

There was also another flaw. Should be: ```  
plugins.scheduler.addCronJob(‘12:20am’,‘0 20 0 ? \* \*’,dailyUpdate);

```auto
The original called for "no special value" for **both** day of month **and** day of week. The revision calls for **every** day of the week. The docs are "legal" although not as transparent as they could be. <img src="{SMILIES_PATH}/icon_wink.gif" alt=":wink:" title="Wink" /> 

Thanks. My first Cron seems to be on its way.
```
