AyKarsi
AyKarsi

Reputation: 9675

Make PM2 run job only once every 10 minutes

I have the following .json configuration for a job that I need to run once every 10 minutes and then do nothing for the remaining time...

"name"        : "test.10minjob",
"cron_restart": "*/10 * * * *",
"autorestart" : false,
"exec_mode"   : "cluster",
"instances"   : 1,

If I run it like this, it will run once and never restart.

If I run it with autorestart set to true, it will restart every time the job exits (i.e. is done).

Am I missing something obvious here?

Upvotes: 13

Views: 4923

Answers (1)

arnonuem
arnonuem

Reputation: 1337

You could try this cron expression 0 0/10 * 1/1 * ? * I created it using this tool:

http://www.cronmaker.com

The expression looks very different from yours and also if i put yours into a cron parser it complains about an invalid expression.

Upvotes: 2

Related Questions