How to run cronjobs per second?

21 Aug

Have you checked my previous article on cronjobs…

To run cronjob per second you have to execute crontab/cronjob per minute and then have to run task in cron file per second using PHP function time_sleep_until().


$start = microtime(true);



/// here is the tasks which need to run per second…


time_sleep_until($start + $ii + 1);
} // end for

if (!function_exists(‘time_sleep_until’))
function time_sleep_until($future)
if ($future < time())
trigger_error(“Time in past”, E_USER_WARNING);
return false;

usleep(($future – microtime(1))*1000000);
return true;


1 Comment

Posted by on August 21, 2010 in CentOS, Fedora, Linux, Tricks


Tags: , , , ,

One response to “How to run cronjobs per second?

  1. Medicine Ball Exercises

    September 21, 2010 at 7:12 pm

    nice post. thanks.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: