This article describes how to use Joomla's CLI (command-line interface) applications to do administration tasks from the command line. You can use these application scripts in cron jobs to automate common administration tasks.
Unfortunately, Joomla does not have a complete CLI administration solution like WP-CLI for WordPress or Drush for Drupal. However, Joomla does include some application scripts that you can use to do common administrative tasks from the command line.
Because these applications are PHP scripts, you can run them automatically in cron jobs. For information about how to run PHP scripts from cron jobs, please see this article.
The following sections describe the CLI applications included with Joomla.
You can remove expired cache data by using the garbagecron.php application. By running this application periodically, you can keep the Joomla cache at a manageable size and reduce disk space usage.
To run this application, type the following commands:
cd ~/public_html/cli php garbagecron.php
For more information about this application, please visit https://docs.joomla.org/Purging_expired_cache_files.
You can download extension update information by using the update_cron.php application. By running this application periodically, you can make sure that the Joomla administration interface always has up-to-date information about available extension updates.
To run this application, type the following commands:
cd ~/public_html/cli php update_cron.php
You can remove old files that remain after an update by using the deletefiles.php application. By running this application periodically, you can help reduce disk space usage and keep your Joomla installation streamlined.
To run this application, type the following commands:
cd ~/public_html/cli php deletefiles.php
You can manage the Smart Search indexing feature by using the finder_indexer.php application.
If you run this application with no arguments, it updates the search index incrementally. Alternatively, if you use the —purge option, it deletes and then rebuilds the entire index.
To run this application, type the following commands:
cd ~/public_html/cli
php finder_indexer.php --purge
For more information about this application, please visit https://docs.joomla.org/Setting_up_automatic_Smart_Search_indexing.
You can also create your own Joomla CLI applications for custom tasks that you want to automate. To do this, we recommend using the Joomla Framework, an extensible, lightweight framework for PHP applications.
For more information about the Joomla Framework, please visit https://framework.joomla.org.
Subscribe to receive weekly cutting edge tips, strategies, and news you need to grow your web business.
No charge. Unsubscribe anytime.
Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.
We use cookies to personalize the website for you and to analyze the use of our website. You consent to this by clicking on "I consent" or by continuing your use of this website. Further information about cookies can be found in our Privacy Policy.