Browse posteets
About
Contact
Log In
Register
View: Preventing Cron Job Collision
Preventing Cron Job Collision
7 months ago
by
spirit
$fp
=
fopen
(
'/tmp/lock.txt'
,
'r+'
)
;
if
(
!
flock
(
$fp
, LOCK_EX | LOCK_NB
)
)
{
echo
'Unable to obtain lock'
;
exit
(
-1
)
;
}
/* ... */
fclose
(
$fp
)
;
collision
cron
php
Embed
|
View source
Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2040"></script>
0 comment
about "Preventing Cron Job Collision"
Tags
collision
cron
php
Note
Prevents jobs to collide if they take longer to run than the frequency itself
0 comment about "Preventing Cron Job Collision"