1
CLI-Usage
Jonathan Miller edited this page 2026-06-04 18:48:54 +00:00

CLI Usage

MokoJoomBackup provides CLI access through both the Joomla console plugin and a standalone CLI script.

The plg_console_mokobackup plugin registers commands with Joomla's CLI framework. Use php joomla.php from the site root:

mokobackup:run

Run a backup using a specified profile.

php joomla.php mokobackup:run
php joomla.php mokobackup:run --profile=2
php joomla.php mokobackup:run --profile=1 --description="Pre-deploy backup"
Option Default Description
--profile, -p 1 Profile ID to use
--description, -d (auto) Backup description

mokobackup:list

List backup records with optional filtering.

php joomla.php mokobackup:list
php joomla.php mokobackup:list --limit=50
php joomla.php mokobackup:list --status=fail
Option Default Description
--limit, -l 20 Number of records to show
--status, -s (all) Filter by status: complete, fail, running

mokobackup:profiles

List available backup profiles.

php joomla.php mokobackup:profiles

mokobackup:restore

Restore a backup by record ID. Prompts for confirmation before proceeding.

php joomla.php mokobackup:restore 42

mokobackup:cleanup

Clean up old backup records and archive files.

php joomla.php mokobackup:cleanup
php joomla.php mokobackup:cleanup --max-age=14 --max-count=5
php joomla.php mokobackup:cleanup --dry-run
Option Default Description
--max-age 30 Max age in days
--max-count 10 Max number of backups to keep
--dry-run false Show what would be deleted without deleting

Legacy CLI Script

The standalone CLI script is still available for environments where the console plugin is not loaded:

php administrator/components/com_mokobackup/cli/mokobackup.php
php administrator/components/com_mokobackup/cli/mokobackup.php --profile=2

Cron Setup

# Daily full backup at 2:00 AM (console command)
0 2 * * * cd /var/www/joomla && php joomla.php mokobackup:run --profile=1

# Hourly database-only backup
0 * * * * cd /var/www/joomla && php joomla.php mokobackup:run --profile=2

# Weekly cleanup
0 3 * * 0 cd /var/www/joomla && php joomla.php mokobackup:cleanup --max-age=30 --max-count=10

Exit Codes

Code Meaning
0 Success
1 Failure