Per Jessen schrieb:
Jochem Maas wrote:
lockfile=/var/lock/<xxxx>/file
# clear out a lock older than 60mins
find $lockfile -cmin +60 | xargs rm
test ! -f $lockfile && (
touch $lockfile
<run some php>
rm -f $lockfile
)
wouldn't creating a dir be better here? (with regard to atomicity)
I haven't thought it through, but I don't think it would change
anything.
/Per Jessen, Zürich
Hello everybody,
thank you for the huge amount of replies on my question. I believe I
quite lost a bit track on how to solve the problem hands on. To
summerize, there are aparently two ways of skinning the cat :-)
1. Run a deamon
I admit I have never wrote one, and that seems therefore to be the
harder option for me. Well... perhaps not.
I assume it is simply creating a shell script like Jochem wrote, however
I guess it would just take longer for me to get it running as I have
never done that before.
2. Create a PHP file that holds some lock code which is triggered by
CRON every 5 minutes. Taking the example from Robert.
3. Following idea which I am now actually implementing :-)
- Add all emails into a mysql db with one insert command.
- Run a php script by cron every 5 min that does the following:
- update table, set session_id = x on all entries without session id
- get all entries with that session ID
- send email to those with that session ID
- remove all entries with that session ID
Looks like easies sollution on how to skimm the cat. DB might not be the
most performing sollution, but sufficient considering the hard ware power.
Thanks for your help!
Regards,
Merlin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php