E
E
Equilibrium072014-05-29 11:21:47
PHP
Equilibrium07, 2014-05-29 11:21:47

CentOS and crontab glitch... running task multiple times in 1 minute?

cron log

May 29 09:30:01 brandage CROND[22306]: (web3) CMD (/usr/bin/php -f ***/web/work/7style.php)
May 29 09:50:01 brandage CROND[22443]: (web3) CMD (/usr/bin/php -F ***/web/work/modamio.php >> ***/web/work/modamioerr.log)
May 29 10:00:01 brandage CROND[22480]: (web3) CMD (/usr/bin/php -F ***/web/work/modamio.php >> ***/web/work/modamioerr.log)
May 29 10:00:01 brandage CROND[22481]: (web3) CMD (/usr/bin/php -F ***/web/work/7style.php)
May 29 10:10:01 brandage CROND[22708]: (web3) CMD (/usr/bin/php -F ***/web/work/modamio.php >> ***/web/work/modamioerr.log)

cron tasks
*/30 * * * * /usr/bin/php -F ***/web/work/7style.php
*/10 * * * * /usr/bin/php -F ***/web/work/modamio.php >> ***/web/work/modamioerr.log

I am writing a question at 12 o'clock Moscow time, server time:
# date
Thu May 29 12:17:29 MSK 2014

at */10 it should run once every 10 minutes.. so cron has only 10 hours now... how so?
Well, in the end:
May 28 19:30:01 brandage CROND[11874]: (web3) CMD (/usr/bin/php -f ***/web/work/7style.php)
May 28 19:30:01 brandage CROND[11872]: (web3) CMD (/usr/bin/php -f ***/web/work/7style.php)

why can this happen?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stepan, 2014-05-29
@Equilibrium07

at */10 it should run once every 10 minutes.. so cron has only 10 hours now... how so?

Isn't that how it happens?
May 29 09:50:01 ...
May 29 10:00:01
May 29 10:10:01

About 2 times it starts, there was the same problem a couple of years ago. But I don’t remember how they decided.. Put a lock on the launch in the script and the script simply won’t start 2 times.
<?php
$file='/var/www/xxx/status/sms_st.lock';
if(!flock($lock_file = fopen($file, 'w'), LOCK_EX | LOCK_NB))
  die("Already running\n");
?>

E
Equilibrium07, 2014-05-29
@Equilibrium07

Well, what about time?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question