Skip to content

Scheduled Tasks

Ed Mozley edited this page Aug 2, 2026 · 2 revisions

Scheduled tasks (cron jobs)

Some things in FreeITSM cannot happen while somebody is looking at a screen. An SLA breaches at 3am. A contract expires in 30 days. A developer comments on a Jira issue and nobody is watching. For those, FreeITSM needs a small job that wakes up on a timer.

None of them are set up for you. A fresh install has no scheduled tasks at all, and the features that depend on them fail silently β€” nothing errors, nothing appears in a log, the feature simply never happens. This page lists every one, what breaks without it, and how to set it up on Windows and Linux.

⚠️ Silent is the important word. A tracker whose status never changes looks exactly like a tracker where nothing has happened. An SLA that never breaches looks like good service. If a time-based feature "doesn't seem to work", check this page first.


The four jobs

Job What it does What breaks without it Suggested interval
cron/integration_poll.php Asks Jira (and other issue trackers) what has changed Issue status never updates and comments never come back β€” see Issue trackers every 5 minutes
cron/sla_breach_check.php Checks open tickets against their SLA targets SLA warning and breach notifications are never sent every 5 minutes
cron/webhook_deliveries.php Delivers queued outbound webhooks, with retries Webhooks fired by workflows sit in the queue and never send every 1 minute
cron/workflow_scheduled.php Fires time-based workflow triggers Rules like "this contract expires in 30 days" never run every 5 minutes

Each also has its own detailed setup document in the docs/ folder of the application: integration-poll-cron-setup.md, sla-cron-setup.md, webhook-cron-setup.md and workflow-scheduled-cron-setup.md.

Which do I actually need?

Only the ones matching the features you use. If you have no issue tracker connected, the tracker poll does nothing useful. If you have never written a workflow, the scheduled-workflow job has nothing to fire. If in doubt, set up all four β€” an unused job costs a second of CPU and prints one line saying it had nothing to do.


Windows (Task Scheduler)

Run these in a Command Prompt opened as Administrator. Adjust the two paths if your PHP or FreeITSM lives elsewhere.

schtasks /create /tn "FreeITSM Tracker Poll" /tr "C:\wamp64\bin\php\php8.4.0\php.exe C:\wamp64\www\freeitsm-app\cron\integration_poll.php" /sc minute /mo 5 /ru SYSTEM

schtasks /create /tn "FreeITSM SLA Breach Check" /tr "C:\wamp64\bin\php\php8.4.0\php.exe C:\wamp64\www\freeitsm-app\cron\sla_breach_check.php" /sc minute /mo 5 /ru SYSTEM

schtasks /create /tn "FreeITSM Webhooks" /tr "C:\wamp64\bin\php\php8.4.0\php.exe C:\wamp64\www\freeitsm-app\cron\webhook_deliveries.php" /sc minute /mo 1 /ru SYSTEM

schtasks /create /tn "FreeITSM Scheduled Workflows" /tr "C:\wamp64\bin\php\php8.4.0\php.exe C:\wamp64\www\freeitsm-app\cron\workflow_scheduled.php" /sc minute /mo 5 /ru SYSTEM

Things that catch people out on Windows

  • If either path contains a space, the command above will fail. Put the whole thing in a .bat file and point the task at that instead β€” far easier than fighting schtasks quoting.
  • /ru SYSTEM tasks are invisible to a normal user. Task Scheduler run without elevation will not list them, and neither will PowerShell's Get-ScheduledTask. Open Task Scheduler as administrator to see them. A task you cannot see is not necessarily a task that does not exist.
  • Last Run Result of 0x41303 means "has not run yet" β€” normal for a task you have just created. It should become 0x0 after its first run.
  • Check the task is Enabled, not merely present. A disabled task sits in the list looking perfectly healthy.

Linux (cron)

*/5 * * * * /usr/bin/php /var/www/freeitsm-app/cron/integration_poll.php    >/dev/null 2>&1
*/5 * * * * /usr/bin/php /var/www/freeitsm-app/cron/sla_breach_check.php    >/dev/null 2>&1
*   * * * * /usr/bin/php /var/www/freeitsm-app/cron/webhook_deliveries.php  >/dev/null 2>&1
*/5 * * * * /usr/bin/php /var/www/freeitsm-app/cron/workflow_scheduled.php  >/dev/null 2>&1

Drop the >/dev/null while you are testing, so cron emails you the output.

Running one by hand

Useful for testing, or before you have set the schedule up. From the application folder:

php cron/integration_poll.php

Each job prints what it did. The tracker poll, for example:

Jira                         checked   1, changed  0
    comments: 1 seen, 1 imported

Checking they are working

The most reliable test is not "does the task exist" but "did something happen that only the job could have caused".

  • Tracker poll β€” change an issue's status in Jira, wait for two intervals, and see whether the pill on the linked ticket follows.
  • Webhooks β€” fire a workflow that sends one, then check the delivery queue empties.
  • SLA β€” the notification arrives, or it does not.

πŸ’‘ Each job refuses to run more often than a minimum interval, and each connection has its own interval too. So running a job twice in quick succession may print "No connections due" or "Rate limited". That is the job protecting itself, not a fault β€” wait and run it again.


What is not a scheduled task

Worth knowing, so you do not go looking for a job that does not exist β€” or create one that should not.

  • Incoming email. Mailboxes are checked by the browser while an analyst has the ticket list open, not by a scheduled job. Mail therefore arrives when somebody is working, which is usually what you want, but it does mean nothing is collected overnight with every browser closed.
  • Snoozed tickets waking up. There is no job. A snoozed ticket reappears because the snooze time has passed β€” it is read from the clock whenever the folder is drawn.
  • InTune synchronisation. scripts/intune_worker.php and intune_app_worker.php look like cron jobs but are not. The application starts them itself when you run a sync. Do not schedule them.

See also: Installation Β· Issue trackers (Jira) Β· Workflows Β· Webhooks

FreeITSM

Getting Started

Modules

Multi-tenancy (planned)

Blue sky thinking

Bugs resolved

Links

Clone this wiki locally