Reference
MokonyxBackup CLI Commands
- Details
- Category: Reference
- Applicable Software: MokonyxBackup
- Min Version Number: 01.00.01
- Max Version Number: Not Applicable
Prefer the terminal? MokonyxBackup ships a full set of Joomla console commands to run backups, list records and profiles, restore, clean up old archives, and manage content snapshots — all driven by the same engine as the web UI and ready to drop into cron.
Overview
MokonyxBackup provides CLI commands via the Joomla console plugin (plg_console_mokonyxbackup). All commands run through Joomla's console entry point from the site root:
php cli/joomla.php <command> [options]
All commands run through the shared BackupRunner service, producing the same complete / warning / fail outcome as the web UI. A legacy standalone script (administrator/components/com_mokonyxbackup/cli/mokonyxbackup.php) is also bundled for existing cron setups.
CLI backups are one of the automated origins that are not gated by the execution-tuning wizard: even while that wizard is still pending on a site, mokonyxbackup:run keeps running on the conservative defaults, so scheduled and unattended CLI jobs are never blocked.
Commands
mokonyxbackup:run
Run an immediate backup.
php cli/joomla.php mokonyxbackup:run --profile=1 --description="Nightly backup"
| Option | Short | Default | Description |
|---|---|---|---|
--profile | -p | 1 | Backup profile ID |
--description | -d | CLI backup | Backup description |
Exit code is 0 on success, 1 on failure. The origin is recorded as cli.
mokonyxbackup:profiles
List all backup profiles (use this to find a profile ID).
php cli/joomla.php mokonyxbackup:profiles
Output columns: ID, Title, Type, Published.
mokonyxbackup:list
List backup records, newest first.
php cli/joomla.php mokonyxbackup:list --status=complete --limit=10
| Option | Short | Default | Description |
|---|---|---|---|
--limit | -l | 20 | Max records to show |
--status | -s | (all) | Filter: complete, fail, running |
Output columns: ID, Profile, Status, Type, Size, Origin, Started.
mokonyxbackup:restore
Restore a completed backup by record ID. This overwrites the current site, so it prompts for confirmation.
php cli/joomla.php mokonyxbackup:restore 42
| Option | Description |
|---|---|
--files-only | Restore files only (skip the database) |
--db-only | Restore the database only (skip files) |
--no-preserve-config | Restore the archived configuration.php instead of keeping the current one |
--password / -p | Decryption password for encrypted archives |
The record must be marked complete and the archive must still exist on disk.
mokonyxbackup:cleanup
Prune old backup records and archive files by age and/or count.
php cli/joomla.php mokonyxbackup:cleanup --max-age=14 --max-count=5
php cli/joomla.php mokonyxbackup:cleanup --dry-run
| Option | Default | Description |
|---|---|---|
--max-age | 30 | Delete backups older than N days |
--max-count | 10 | Keep only the N newest backups |
--dry-run | false | Show what would be deleted without deleting |
mokonyxbackup:snapshot
Create, restore, list, or delete content snapshots (articles, categories, modules) — a lightweight alternative to a full backup for content-only rollbacks.
php cli/joomla.php mokonyxbackup:snapshot create --types=articles,categories,modules --description="Before edit"
php cli/joomla.php mokonyxbackup:snapshot list
php cli/joomla.php mokonyxbackup:snapshot restore --id=5 --mode=replace
php cli/joomla.php mokonyxbackup:snapshot delete --id=5
Cron Integration
# Daily full backup at 2 AM
0 2 * * * cd /var/www/html && /usr/bin/php cli/joomla.php mokonyxbackup:run -p 1
# Weekly cleanup on Sundays
0 3 * * 0 cd /var/www/html && /usr/bin/php cli/joomla.php mokonyxbackup:cleanup --max-age=30 --max-count=10
- Hits: 14
MokonyxBackup REST API & MCP Integration
- Details
- Category: Reference
- Applicable Software: MokonyxBackup
- Min Version Number: 01.00.01
- Max Version Number: Not Applicable
Drive MokonyxBackup remotely over a token-authenticated REST API that's wire-compatible with the mcp_mokonyxbackup MCP server. Start backups, list and download records, manage profiles and backup destinations, and create or inject content snapshots — from your own tooling or straight from an AI assistant.
REST API Endpoints
Routes are registered by plg_webservices_mokonyxbackup and are wire-compatible with the mcp_mokonyxbackup MCP server. The API Application and the Web Services plugin must be enabled. All routes require authentication — send a Joomla API token in the X-Joomla-Token header (or a Bearer token):
X-Joomla-Token: <your-api-token>
Accept: application/jsonBase URL: /api/index.php/v1/mokonyxbackup/.... Each action also enforces a component ACL permission; a failed check returns HTTP 403.
Backup Endpoints
| Method | Endpoint | Description |
|---|---|---|
| POST | /mokonyxbackup/backup | Start a backup (body: profile + description, both optional) |
| GET | /mokonyxbackup/backups | List backup records |
| GET | /mokonyxbackup/backups/:id | Get a single record |
| DELETE | /mokonyxbackup/backup/:id | Delete a backup record + archive |
| GET | /mokonyxbackup/backup/:id/download | Download the archive (binary stream) |
| GET | /mokonyxbackup/profiles | List backup profiles (credentials masked) |
Backup records also expose remote_results (the per-destination delivery outcome), base_record_id (the differential-backup base link), and checksum (archive integrity).
Destination Endpoints
Manage a profile's Destinations — the local and remote backup targets stored in #__mokonyxbackup_remotes (previously admin-only, now fully scriptable). Transport secrets (FTP/SFTP/S3/Google Drive passwords, keys, tokens) are masked on output and merge-preserved on update (echoing back the ******** mask can't blank them). All destination routes require the core.manage permission.
| Method | Endpoint | Description |
|---|---|---|
| GET | /mokonyxbackup/destinations?profile=:id | List a profile's destinations |
| GET | /mokonyxbackup/destination/:id | Get a single destination |
| POST | /mokonyxbackup/destination | Create a destination |
| PATCH | /mokonyxbackup/destination/:id | Update a destination |
| DELETE | /mokonyxbackup/destination/:id | Delete a destination |
| POST | /mokonyxbackup/destination/:id/toggle | Enable / disable a destination |
| POST | /mokonyxbackup/destination/:id/restore-script | Deploy the standalone restore.php through this destination |
Snapshot Endpoints
Content snapshots capture selected content types (articles, categories, modules) as portable JSON. All require the mokonyxbackup.snapshot.manage permission.
| Method | Endpoint | Description |
|---|---|---|
| GET | /mokonyxbackup/snapshots | List snapshots (paginated) |
| POST | /mokonyxbackup/snapshot | Create a snapshot |
| POST | /mokonyxbackup/snapshot/:id/restore | Restore from a snapshot |
| POST | /mokonyxbackup/snapshot/inject | Inject a payload directly (master → slave) |
| DELETE | /mokonyxbackup/snapshot/:id | Delete a snapshot + its data file |
| GET | /mokonyxbackup/snapshot/:id/download | Download the snapshot JSON |
MCP Server
The mcp_mokonyxbackup MCP server is wire-compatible with these endpoints, so an AI assistant can start backups, list records, manage profiles and destinations, and create or inject content snapshots remotely.
CLI
php cli/joomla.php mokonyxbackup:run --profile=1
php cli/joomla.php mokonyxbackup:run --profile=2 --description="Pre-deploy"
- Hits: 15