Which modules use hook_cron?

Drupal Grep

I recently needed to find out a list of modules which used <code>hook_cron</code>. I have SSH access to my server. Instead of writing a module (or using devel to execute some PHP) which returned the result of module_implements, I turned to <code>grep</code>. Simply <code>cd</code> into your modules folder (can be the Drupal install, but you end up recursing through unlikely folders) and run this:

grep -R "^function.*_cron" *module

[adsense:468x60:4496506397]

That will recursively search for all files with any lines that start with function, have anything between that occurrence of function and _cron. You can replace _cron with any hook name you like. I hope this is of use to someone else too.

The Drupal face came from a derrivative of Steven Wittens Wallpapers. If you'd like me to take it down Steven, please let me know - I didn't think you'd mind as there doesn't seem to be any CC license notes on the page in question. Nice wallpapers by the way!

Comment Icon

0 Comments

There are no comments yet. Why not be the first?

Add new comment

Filtered HTML

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <pre> <ul> <ol> <li> <dl> <dt> <dd> <img> <p>
  • You can use BBCode tags in the text. URLs will automatically be converted to links.
  • You can enable syntax highlighting of source code with the following tags: <code>, <pre>, <bash>, <css>, <html>, <js>, <jquery>, <mysql>, <php>. PHP source code can also be enclosed in <?php ... ?> or <% ... %>.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.