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).
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.
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 |
The cron schedule can be entered directly or selected from presets:
*/5 * * * *)*/15 * * * *)0 * * * *)0 3 * * *)0 3 * * 0)The task list shows when each task runs next.
Tasks run in a hardened systemd-run transient service unit:
aipbx-task (created during
installation). They never run as root and never as the web server (www-data)./etc/cron.d/aipbx). If systemd-run or the aipbx-task user is unavailable, the task is not run
at all.ProtectSystem=strict mounts the operating system read-only. Home
directories (ProtectHome=yes) and devices (PrivateDevices=yes) are completely hidden. The task
has a private /tmp directory (PrivateTmp=yes)./var/lib/aipbx/tasks/<id>/.PrivateNetwork=yes) containing only loopback. It cannot access the internet, local
subnets, or internal PBX services.RuntimeMaxSec, MemoryMax, and CPUQuota enforce strict limits.
NoNewPrivileges=yes and RestrictSUIDSGID=yes prevent privilege escalation.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.
Clicking History & Logs shows:
schedule or manual), exit code, and error
messages.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.