Scheduling Jobs

Target Audience: Users, Administrators Difficulty: Beginner Prerequisites: Creating RunTemplates

Overview

In MultiFlexi, jobs are scheduled through RunTemplates. The multiflexi-scheduler daemon periodically checks all active RunTemplates and creates a Job record for each one whose scheduled run time has arrived.

You do not manage individual jobs directly — you configure the RunTemplate schedule and the system handles the rest.

How Scheduling Works

  1. The scheduler daemon ticks roughly every second and scans active RunTemplates whose next_schedule is currently empty

  2. For each due RunTemplate it computes the next run time from its interval (or custom cron expression) and creates a new Job record in the database

  3. It writes that time back to the RunTemplate’s next_schedule column, so the same slot is not enqueued twice

  4. The executor daemon picks up pending Job records (anything whose scheduled time has arrived) and executes them

This means there is only a small delay (typically under a second) between a scheduled time and actual execution start. If a RunTemplate’s schedule state is ever reset (for example by multiflexi-cli queue:fix or queue:truncate), the scheduler catches up on a missed slot on its next tick instead of waiting for the next cadence boundary — see Execution Architecture for the exact algorithm.

Manually triggering a Job (see Triggering a Job Immediately below) does not touch the RunTemplate’s next_schedule/last_schedule and therefore never interferes with its regular cadence.

Interval Reference

Interval

Next run calculation

Typical use case

Manually

Never auto-scheduled

On-demand / ad-hoc runs

Hourly

Top of the next hour

Bank statement polling, health checks

Daily

Same time the next day

Daily reports, nightly imports

Weekly

Same day/time next week

Weekly summaries

Monthly

Same date next month

Monthly invoicing, period-end tasks

Yearly

Same date next year

Annual reports, year-end closing

Viewing the Job Schedule

Via the web interface:

  • The dashboard shows Upcoming Schedule — jobs planned for the near future

  • Company pages show per-company upcoming jobs

Via CLI:

# Show all pending (not yet executed) jobs
multiflexi-cli job:list --status=pending

# Show next run times for all RunTemplates
multiflexi-cli run-template:list

Pausing Scheduling

To stop a RunTemplate from generating new jobs without deleting it, set it to Inactive:

Via web: Open RunTemplate → click “Deactivate” (or toggle the Active switch)

Via CLI:

multiflexi-cli run-template:update --id=42 --active=0

Resuming Scheduling

multiflexi-cli run-template:update --id=42 --active=1

The scheduler will calculate the next run time from now and resume scheduling.

Triggering a Job Immediately

To run a job right now, outside of its normal schedule:

Via web: Open RunTemplate detail → click “▶️ Execute Now”

Via CLI:

multiflexi-cli run-template:schedule --id=42

This creates a Job with status pending which the executor picks up within seconds.

Event-Driven Scheduling

In addition to time-based scheduling, MultiFlexi supports event-driven job triggering via the multiflexi-eventor (event processor) daemon. Jobs can be triggered by:

  • File system events (new file in a watched directory)

  • Webhook notifications

  • Message queue events

Event-driven RunTemplates use the Manually interval and are triggered exclusively by the event processor. See the event processor documentation for configuration details.

Monitoring Job Execution

After a job runs, its status appears in:

  • The Jobs view in the web interface (filter by company, application, status, date)

  • The Dashboard recent jobs widget

  • The Zabbix integration (if configured) — see Zabbix Integration

  • Job logs: journalctl -u multiflexi-executor -f

See Also