Is this permission for cronjob the expression section is true ? i want to automatically it executes the method every 1 minute

Screenshot 2023-08-05 202526

You want it to be:

 "expression": "* * * * *",

This will fire every minute.

2 Likes

Thx but how ? can you please describe “expression” section with some examples ? documents about snaps need improvements.

Sure, here is an example project that uses a cronjob that fires every minute: GitHub - Montoya/pet-fox: Pet Fox snap and companion dapp

It is open source, feel free to use it as a guide.

3 Likes

In this project uses expression as my above example but please answer these questions right here : 1) runs every 5 minutes 2) runs every 1 day 3) runs every 3 weeks. thx

Here is a cronjob cheatsheet: https://www.codementor.io/@akul08/the-ultimate-crontab-cheatsheet-5op0f7o4r

Every 5 minutes would be:
*/5 * * * *

Every day at midnight would be:
0 0 * * *

Or every day at noon would be:
0 12 * * *

Unfortunately you cannot do every 3 weeks, but you can do every week and then just use a counter to ignore the first 2 instances and only execute the code you want to run every 3rd time:
0 0 * * 0

3 Likes