Command-Line Interface - LiteSpeed Cache For WordPress Management

As of LiteSpeed Enterprise 5.1.14, in addition to the plugin features above, a command-line interface script also exists under /usr/local/lsws/admin/misc/lscmctl for executing basic cache management actions through the terminal or in a cron job. The help page for this script is included below.

Note: You must have a license with LSCache enabled to use these features. How To Get LSCache

LiteSpeed Cache Manager CLI Tool v1.2.2
Usage: ./lscmctl [-php path/to/php] command [flag/parameter]
Possible Commands:
setversion [--list] | [--latest] | [$VERSION]
List/Set active LSCWP version. This command will list the currently active
version when no additional input it given. Use --list to show available
versions or --latest to switch to the latest available version. A valid version
number can also be provided to switch to that version specifically. This must
be set before performing other lscmctl operations.
scan [-n] [-e]
Scan for all WordPress installations. This command will create an lscm.data
file under the "lsws/admin/lscdata" directory. Add the -n flag to only discover
new installations. By adding the -e flag, LSC-WP will be enabled on all
installations after scanning is complete.
enable -m | $WP_PATH
Enables LSWCP for all discovered WordPress installations with the -m
parameter or a single installtion by providing the path to the WordPress
installation directory.
disable -m | $WP_PATH
Disables LSWCP for all discovered WordPress installations with the -m
parameter or a single installtion by providing the path to the WordPress
installation directory.
upgrade -m | $WP_PATH
Upgrade LSWCP for all discovered WordPress installations to the current
active version with the -m parameter or a single installtion by providing the
path to the WordPress installation directory.
flag $WP_PATH
Flag a single WordPress installation. Flagged installations will be skipped
during mass operations.
unflag $WP_PATH
Unflag a single WordPress installation. Flagged installations will be
skipped during mass operations.
status $WP_PATH
Get the most up to date LSC-WP status for the provided WordPress
installation.
Example Usage:
Display currently active LSCWP version:
./lscmctl setversion
Display selectable LSCWP versions:
./lscmctl setversion --list
Set active LSCWP version to latest available:
./lscmctl setversion --latest
Set active LSCWP version to v1.5:
./lscmctl setversion 1.5
Discover all installations:
./lscmctl scan
Discover new installations only, passing in path to php binary:
./lscmctl -php /path/to/php/ scan -n
Enable LSC-WP on all discovered installations:
./lscmctl enable -m
Disable LSC-WP for a single installation:
./lscmctl disable /home/user/public_html/wp
Get LSC-WP status for a single installation:
./lscmctl status /home/user/public_html/wp

Scan And Enable Using A CronJob

If you do not want to continue manually running the CLI script you can setup a cronjob to run the script at fixed intervals instead.

First, as root, open crontab cronjobs with command

crontab -e

After that, you can add a line, in the usual cronjob format, similar to the following:

00 03 * * * /usr/local/lsws/admin/misc/lscmctl scan -e

This command will run the CLI script daily at 3am, re-discovering all current and new WordPress installations and mass enabling LSCWP on any unflagged installations.