documentation question

Created on 29 September 2012, almost 13 years ago
Updated 9 July 2025, 23 days ago

I'm just looking to add a job to execute some code every hour. The documentation is somewhat unclear how to add jobs. It says:

Add a job.

$job = array(
'callback' => 'mymodule_unpublish_nodes',
'type' => 'story',
'id' => 12,
'period' => 3600,
'periodic' => TRUE,
);
job_scheduler()->set($job);

But where do I add this code? Is there a hook I should implement to execute this code? Just run it once? Also, what are the units for the 'period', seconds, minutes?

πŸ’¬ Support request
Status

Closed: outdated

Version

2.0

Component

Documentation

Created by

πŸ‡ΊπŸ‡ΈUnited States blairCruz

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024