This is an old revision of the document!
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.
Learn more about the CLI script on our blog.
Note: You must have a license with LSCache enabled to use these features. How To Get LSCache
LiteSpeed Cache Manager Script Help Page This script requires that you have cPanel with LiteSpeed Web Server Plugin installed. Usage: ./lscmctl [-php path/to/php] command [flag/parameter] Possible Commands: scan [-n] [-e] Scan for all WordPress installations. This command will create an lsc_manager_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. setversion [--list] | [$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. Provide a valid version number to switch to that version. 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 installation 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 LSCWP status for the provided WordPress installation. Example Usage: Discover all installations: ./lscmctl scan Discover new installations only, passing in path to php binary: ./lscmctl -php /path/to/php/ scan -n Display currently active LSCWP version: ./lscmctl setversion Set new active LSCWP version: ./lscmctl setversion 1.5 Enable LSCWP on all discovered installations: ./lscmctl enable -m Disable LSCWP for a single installation: ./lscmctl disable /home/user/public_html/wp Get LSCWP status for a single installation: ./lscmctl status /home/user/public_html/wp
Setup CronJob in cPanel
If you do not want to run the script every day you can setup a cronjob for that. The important here is the fact that you need to scan once manually. After that you can let the cron to do the work.
First open the cronjobs from ssh root with:
crontab -e
After that put:
00 03 * * * /usr/local/lsws/admin/misc/lscmctl scan -n -e
That command will be run at 3am every day and will discovery and enable lscwp.