*/5 * * * * my command
This entry works but every 5 minutes it gets executed twice, why?
In /var/log/cron it shows:
I thought cron was launching my bash script twice, but I was wrong. I thought I'd share my experience for (hopefully) the benefit of others. It had me scratching my head for a bit ...
At the moment of being launched by cron, 'ps aux' output changed from showing 0 instances of my script running to two instances, or so it seems at first blush:
kdeen 1797750 0.0 0.0 2608 600 ? Ss 15:52 0:00 /bin/sh -c /home/kdeen/bin/once-a-day-local.sh
kdeen 1797751 0.0 0.0 19520 3488 ? S 15:52 0:00 /bin/bash /home/kdeen/bin/once-a-day-local.sh
But look a little closer and I see one instance is /bin/sh -c and the other is /bin/bash. This is correct behavior. My script starts with "#!/bin/bash" but cron ALWAYS runs stuff with /bin/sh. So there's an 'sh' launcher process and then there's my bash script. All good.