Reputation: 801
What does Unix Kernel do if cron job set for every minute is executing a file which takes time more than 1 minute.
For Example:
I have following Shell Command to execute PHP Script every minute.
* * * * * php /home/user/public_html/script.php
And My PHP script consists SQL code to select emails from database and send mails to given Emails using for loop.
Problem: How the system kernel will response if my database consists thousands of mail which takes more than 1 minute to finish the 1st execution.
Upvotes: 0
Views: 106
Reputation: 1338
You have 2 options:
We often use option two and simply write a lock flag to the DB or to the filesystem - and then clear it once the script has completed.
Upvotes: 0
Reputation: 207758
It will execute it again, unless you take steps yourself to prevent more than one instance running. You can test it by running a script that does:
date >> /tmp/a
sleep 90
date >> /tmp/a
Upvotes: 3