We’re using CLI (specifically WP CLI) a lot and this week I’ve spent a couple of days trying to find a reason for a very strange behavior. A task, scheduled to execute every 54 minutes does so, but also starts at 00 minutes every hour. I might have never found it, but that specific task sent emails at every run to different people and they started complaining about spam.
The reason appeared to be in how exactly schedule was set in crontab file.
*/54 * * * * means that command will be executed every 54 minutes INSIDE given hour. So it will run at 2:00, then at 2:54, then at 3:00, at 3:54 and so on. Not “every” 54 minutes as I thought.
Changed schedule to 54 * * * * and now it starts only once an hour, at 54 minutes.
God Bless crontab 🙂