Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using a cron to take data from Facebook and i have divided the job into three calls, to avoid making to many call all toghether, now how do i set up calls so that they don't overlap?

// Set the CRON for pages
wp_schedule_event(  current_time( 'timestamp' ), self::FB_CRON_FREQUENCY, self::FB_CRON_PAGES, array( Ai1ec_Facebook_Graph_Object_Collection::FB_PAGE ) );
// Set the CRON for groups
wp_schedule_event(  current_time( 'timestamp' ), self::FB_CRON_FREQUENCY, self::FB_CRON_GROUPS, array( Ai1ec_Facebook_Graph_Object_Collection::FB_GROUP ) );
// Set the CRON for users
wp_schedule_event(  current_time( 'timestamp' ), self::FB_CRON_FREQUENCY, self::FB_CRON_USERS, array( Ai1ec_Facebook_Graph_Object_Collection::FB_USER ) );

So i want all of the calls to run every two hours, but i want one to run at minute 15, one at minute 30 and one at minute 45 so that they do not overlap, how can i do that?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Ok that was pretty easy

// Set the CRON for pages
wp_schedule_event(  current_time( 'timestamp' ) + 450, self::FB_CRON_FREQUENCY, self::FB_CRON_PAGES, array( Ai1ec_Facebook_Graph_Object_Collection::FB_PAGE ) );
// Set the CRON for groups
wp_schedule_event(  current_time( 'timestamp' ) + 900, self::FB_CRON_FREQUENCY, self::FB_CRON_GROUPS, array( Ai1ec_Facebook_Graph_Object_Collection::FB_GROUP ) );
// Set the CRON for users
wp_schedule_event(  current_time( 'timestamp' ) + 1350, self::FB_CRON_FREQUENCY, self::FB_CRON_USERS, array( Ai1ec_Facebook_Graph_Object_Collection::FB_USER ) );
share|improve this answer
    
accept your own answer. –  Pontus Abrahamsson Aug 15 '12 at 7:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.