Return to site

Spring CRON vs Linux CRON: NOT THE SAME ⚡⚡⚡

· devops,java,springboot

A Spring Scheduled tasks is like this:

  • 1️⃣2️⃣3️⃣4️⃣5️⃣6️⃣---------index
  • ▶️▶️▶️▶️▶️▶️------command to be executed
  • ⬆️⬆️⬆️⬆️⬆️⬆️------ Day of week (MON - SUN)
  • ⬆️⬆️⬆️⬆️⬆️-------- Month (1 - 12)
  • ⬆️⬆️⬆️⬆️----------- Day of month (1 - 31)
  • ⬆️⬆️⬆️------------- Hour (0 - 23)
  • ⬆️⬆️-------------- Minute (0 - 59)
  • ⬆️---------------- Seconds (0 - 59)

 

A Linux Cron job is like this:

  • 1️⃣2️⃣3️⃣4️⃣5️⃣---------index
  • ▶️▶️▶️▶️▶️------command to be executed
  • ⬆️⬆️⬆️⬆️⬆️-------- Day of week (0 - 7) (Sunday=0 or 7)
  • ⬆️⬆️⬆️⬆️----------- Month (1 - 12)
  • ⬆️⬆️⬆️------------- Day of month (1 - 31)
  • ⬆️⬆️--------------Hour (0 - 23)
  • ⬆️---------------- Minute (0 - 59)

Conclusion: ⚠️ careful: if spring 6 values

#spring #cron #spring6digitscron