Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7503175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:07:50+00:00 2026-05-29T21:07:50+00:00

I am building a Drupal 6 module for a client and I want to

  • 0

I am building a Drupal 6 module for a client and I want to execute some part of code every XYZ minutes. I know I can implement the cron_hook, but my module has no control over the client’s cron. I need to run my code irrespective of cron setting. Any ideas on how to approach this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T21:07:52+00:00Added an answer on May 29, 2026 at 9:07 pm

    Drupal doesnt really offer anything beyond the hook_cron functionality.

    However, what you can do is define a normal menu callback that executes whatever aribitarary code you want to run. Just set up the job manually in your server’s cron-tab to fire it whenever you want

    <?
    function example_menu() {
    
        $items = array();
        $items['example/cron'] = array(
            'title' => 'example Cron',
            'page callback' => 'example_callback',
            'type' => MENU_CALLBACK,
        );
    
    }
    
    function example_callback(){
          //optionally do some IP checking to make sure its not being fired by a remote request
    
          set_time_limit(0); //set it so your cron wont time out if it takes a long time to process ... be careful your cron doesnt run forever though
    
          watchdog('example', "Cron Started", array(), WATCHDOG_NOTICE);
          //execute custom code here
          for($i = 0; $i < 100; $i++){
             //do stuff
          }
    
          watchdog('example', "Cron Complete", array(), WATCHDOG_NOTICE);
    
        }
    

    Once you have that, just set up a cron job to hit the url however often you want

    X Y * * * curl http://examplesite.com/example/cron 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a Drupal theme up and want to know if there is a
I am building a Drupal website and want to have a facebook like box
I am building a Drupal module that (among other things) creates multiple nodes of
I'm building a Drupal module to tie an icon to a particular page using
RRULE:FREQ=DAILY;INTERVAL=1;BYDAY=TU,WE,FR;UNTIL=20110713T075959Z;WKST=SU I'm building a drupal site and the Date module outputs this code, which
I am building a custom module in Drupal 7. I have a URL which
I am building a CMS for a client, and I needed some inspiration from
Anyone able to offer some ideas on this? Basically the module I'm building has
I am building a complex AJAX based solution as a module into a Drupal
Drupal's webform module is awesome for building forms, but since my form is very

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.