AiPBX

Scheduled tasks

AiPBX can run background shell, PHP, or Python scripts on a cron schedule: for example to export CDR records nightly to an SFTP server, synchronize contacts with an external CRM, run custom maintenance, or poll an API.

System → Scheduled tasks (administrators only, off by default).

Feature status

Scheduled tasks are disabled globally by default. When switched off, no tasks run, and Run now is refused. Enable scheduled execution with the toggle at the top of the page.

Configuration

Each task defines:

Field Description Defaults / limits
Task Name Identifying name 1–100 characters
Description Optional explanation of the task’s purpose  
Active Whether the schedule runs automatically On / Off
Cron Schedule Standard 5-field cron expression (min hour day month weekday) Presets available
Interpreter Script language: shell (/bin/bash), PHP (/usr/bin/php), or Python (/usr/bin/python3) Shell
Script Code The executable script code  
Timeout Maximum execution time before termination 5–3600 s (default 300 s)
Memory Limit Maximum RAM allocated to the task cgroup 32–4096 MB (default 256 MB)
CPU Limit Maximum CPU quota percentage 5–100 % (default 50 %)
Network Access Allow outgoing network traffic from the sandbox Off by default

Schedule presets

The cron schedule can be entered directly or selected from presets:

The task list shows when each task runs next.

Sandbox security

Tasks run in a hardened systemd-run transient service unit:

Run now

Clicking Run now requests an immediate execution. To maintain security boundaries, the web portal (www-data) does not execute the script directly; instead, it queues the request in the database. The root dispatcher picks up the request and executes the task in the sandbox within a minute.

History and output

Clicking History & Logs shows:

Alarms and audit log

Direct data access through curated database views (aipbx_export), per-task database credentials, and per-task REST API tokens is planned for a future update (see Roadmap). Currently, scripts access external resources or APIs using their own configured credentials.