I need a cron job to check email accounts and download certain attachments. This cron job will be running every minute. My problem is that when the first script is downloading email attachments, a second (or third or fourth ...) script will most likley be running alongside the previously executed script. The problem is that I am not sure what is the best way to prevent subsequent scripts from trying to download the email attachments that the previous scripts have downloaded (or is currently downloading).
Other details:
- Using CodeIgniter
- Using Zend Mail library to access emails and download attachments
- Email is probably going to be POP3
I'm wondering if I can use "message-id" header somehow.