Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
litespeed_wiki:cpanel:cli-lscwp-management [2018/06/12 13:44]
Michael Alegre [Setup CronJob in cPanel]
litespeed_wiki:cpanel:cli-lscwp-management [2019/07/01 18:10]
Michael Alegre [Command-Line Interface - LiteSpeed Cache For WordPress Management] Updated script help page to match v1.7 help output.
Line 1: Line 1:
 ====== Command-Line Interface - LiteSpeed Cache For WordPress Management ====== ====== 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.+This page covers the various cache management options available through our lsmctl cli script. Most of these options are also available through our [[litespeed_wiki:​cpanel:​whm-plugin-lscwp-management|WHM plugin for cPanel]]. 
 + 
 +As of LiteSpeed Enterprise 5.1.14, a command-line interface script ​was added under ''/​usr/​local/​lsws/​admin/​misc/​lscmctl''​ for executing basic cache management actions through the terminal or in a cron job. As of versions 1.4 of the script, the ability to recommend a plugin or broadcast a message to all discovered WordPress installations is also available. The help page for this script is included below.
  
 [[https://​blog.litespeedtech.com/​2017/​06/​28/​wpw-autodiscovery-lscache-and-the-command-line/​|Learn more about the CLI script on our blog.]] [[https://​blog.litespeedtech.com/​2017/​06/​28/​wpw-autodiscovery-lscache-and-the-command-line/​|Learn more about the CLI script on our blog.]]
 +
 +**Supported Control Panel Environments:​** cPanel/WHM and Plesk
  
 **Note:** You must have a license with LSCache enabled to use these features. **[[litespeed_wiki:​licenses:​add-lscache|How To Get LSCache]]** **Note:** You must have a license with LSCache enabled to use these features. **[[litespeed_wiki:​licenses:​add-lscache|How To Get LSCache]]**
  
 <​code>​ <​code>​
-LiteSpeed Cache Manager ​Script Help Page+LiteSpeed Cache Manager ​CLI Tool v1.7                                                                                                                                                                       
 +                                                                                                                                                                                                            
 +                                                                                                                                                                                                            
 +Usage: ./lscmctl [-php path/​to/​php] command [flag/​parameter] ​                                                                                                                                               
 +                                                                                                                                                                                                            
 +                                                                                                                                                                                                            
 +Possible Commands: ​                                                                                                                                                                                         
 +                                                                                                                                                                                                            
 +setcacheroot [-svr <cache root>] [-vh <cache root>​] ​                                                                                                                                                        
 +    List/Set server and/or virtual host cache roots. This command will list the                                                                                                                             
 +current server and virtual host cache roots when no additional input is given. ​                                                                                                                             
 +Use -svr and -vh to set those cache roots. The '​$'​ character is not allowed ​                                                                                                                                
 +when setting virtual host cache root. Virtual host cache root values starting ​                                                                                                                              
 +with a '/'​ will automatically have '/​$vh_user'​ appended to the end (this format ​                                                                                                                            
 +was chosen to maintain compatibility with CageFS). ​                                                                                                                                                         
 +                                                                                                                                                                                                            
 +setversion [{--list | --latest | <​version>​}] ​                                                                                                                                                               
 +    List/Set active LSCWP version. This command will list the currently active ​                                                                                                                             
 +version when no additional input is 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.
  
-This script requires that you have cPanel ​with LiteSpeed Web Server Plugin installed.+enable {-m | <wp path>} 
 +    Enables LSWCP for all discovered WordPress installations ​with the -m  
 +parameter or a single installation by providing the path to the WordPress  
 +installation directory.
  
-Usage: ./lscmctl [-php path/to/php] command [flag/parameter]+disable {-m | <​wp ​path>} 
 +    Disables LSWCP for all discovered WordPress installations with the -m  
 +parameter ​or a single installation 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.
  
-Possible Commands:+flag <wp path> 
 +    Flag a single WordPress installation. Flagged installations will be skipped  
 +during mass operations.
  
-scan [-n] [-e] +unflag {-m | <wp path>} 
-        Scan for all WordPress installations. This command will create an lsc_manager_data file under the '​.../​lsws/​admin/​lscdata'​ directory. ​ +    ​Unflag ​all discovered ​WordPress installations ​with the -m parameter or a  
-        ​Add ​the -n flag to only discover new installations.  +single installation by providing ​the path to the WordPress installation  
-        By adding the -e flag, LSC-WP ​will be enabled on all installations after scanning is complete.+directory. Flagged ​installations will be skipped during mass operations.
  
-setversion [--list] | [$VERSION] +status <wp path> 
-        ​List/​Set active LSCWP version. This command will list the currently active version when no additional input it given. ​ +    ​Get ​the most up to date LSC-WP status for the provided WordPress ​ 
-        Use --list to show available versions. Provide a valid version number to switch to that version.+installation.
  
-enable ​-m | $WP_PATH +dashnotify {-m | -wppath <wp path>} [-plugin <plugin slug>] {-msgfile <message file path> | -msg <​message>​} 
-        ​Enables LSWCP for all discovered WordPress installations with the -m parameter or a single ​installtion ​by providing the path to the WordPress  +    ​Notify ​all discovered WordPress installations ​with the provided message  
-        installation directory.+(plain text or HTML) using the Dash Notifier WordPress plugin ​with the -m  
 +parameter or a single ​installation ​by providing the path to the WordPress  
 +installation directory. A plugin slug can be included to have an  
 +install/​activate button for that plugin added to the message as well.  
 +Installations containing a '​.dash_notifier_bypass'​ file will not be notified.
  
-disable ​-m | $WP_PATH +dashnotifyremove {-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 ​ +    ​Remove Dash Notifier plugin (and notification messages) from all discovered ​ 
-        ​installation directory.+WordPress installations with the -m parameter or a single ​installation ​by  
 +providing the path to the WordPress installation directory.
  
-upgrade ​-$WP_PATH +cpanelplugin {--install | --uninstall | -autoinstall [{0 1}]} 
-        ​Upgrade LSWCP for all discovered WordPress installations ​to the current ​active version with the -m parameter or a single installation by  +    ​[cPanel/​WHM Environment Only] Install or uninstall the LiteSpeed user-end  
-        ​providing ​the path to the WordPress installation directory.+plugin for cPanel ​for all cPanel accounts using the '​--install'​ and  
 +'​--uninstall'​ input flags. The plugin will appear as "​LiteSpeed Web Cache  
 +Manager"​ under '​Advanced'​ in the user's cPanel dashboard. The '​-autoinstall'​  
 +input param can be used to check the current ​auto install status. When turned  
 +on, the cPanel plugin will be automatically installed when installing/​updating ​ 
 +the WHM plugin. Use '​-autoinstall {0 | 1}' ​to manually turn this off and on  
 +respectively.
  
-flag $WP_PATH +addinstalls {-wpinstall <wp path> <​docroot>​ <server name> <site url>} | -wpinstallsfile <​installs file path>} 
-        ​Flag ​single ​WordPress installation. ​Flagged installations ​will be skipped during mass operations.+    ​Add ​a WordPress installation ​to existing scan dataThis "​custom"​ data will  
 +be stored in it's own lscm.data.cust data file under the "​lsws/​admin/​lscdata"​  
 +directory. A single installation can be added using the -wpinstall parameter  
 +with space separated list of installation info in the required order (<wp path>  
 +<​docroot>​ <server name> <site url>). Multiple installations can be added at  
 +once using the -wpinstallsfile parameter to provide the path to an installs  
 +file containing a newline separated list of installation info in the expected  
 +format.
  
-unflag $WP_PATH 
-        Unflag a single WordPress installation. Flagged installations will be skipped during mass operations. 
  
-status $WP_PATH +Example Usage:
-        Get the most up to date LSCWP status for the provided WordPress installation.+
  
 +  List server and virtual host cache roots:
 +  ./lscmctl setcacheroot
  
-Example Usage:+  Set virtual host cache root: 
 +  ./lscmctl setcacheroot -vh /​path/​to/​ssd/​lscache
  
-Discover all installations+  Display currently active LSCWP version
-./​lscmctl ​scan+  ./​lscmctl ​setversion
  
-Discover new installations only, passing in path to php binary+  Display selectable LSCWP versions
-./lscmctl -php /​path/​to/​php/​ scan -n+  ./​lscmctl ​setversion ​--list
  
-Display currently ​active LSCWP version: +  Set active LSCWP version ​to latest available
-./lscmctl setversion+  ./lscmctl setversion ​--latest
  
-Set new active LSCWP version: +  ​Set active LSCWP version ​to v1.5
-./lscmctl setversion 1.5+  ./lscmctl setversion 1.5
  
-Enable LSCWP on all discovered ​installations:​ +  Discover ​all installations:​ 
-./​lscmctl ​enable -m+  ./​lscmctl ​scan
  
-Disable LSCWP for a single installation+  Discover new installations only, passing in path to PHP binary
-./​lscmctl ​disable ​/home/user/public_html/wp+  ./​lscmctl ​-php /path/to/phpscan -n
  
-Get LSCWP status for a single installation+  Enable LSC-WP on all discovered installations
-./​lscmctl ​status /​home/​user/​public_html/​wp +  ./​lscmctl ​enable -m
-</​code>​+
  
-====== Setup CronJob ​in cPanel ======+  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 
 + 
 +  Send a simple dashboard message to a single discovered WordPress installation:​ 
 +  ./lscmctl dashnotify -wppath /​path/​to/​wp/​install -msg "Hello World!"​ 
 + 
 +  Broadcast a dashboard message recommending the LiteSpeed Cache for WordPress plugin to all discovered WordPress installations:​ 
 +  ./lscmctl dashnotify -m -plugin litespeed-cache -msgfile /​path/​to/​msg/​file 
 + 
 +  Remove dashboard notifications (and Dash Notifier plugin) from all discovered WordPress installations:​ 
 +  ./lscmctl dashnotifyremove -m 
 + 
 +  [cPanel/WHM Environment Only] Install the LiteSpeed user-end plugin for cPanel for all cPanel accounts: 
 +  ./lscmctl cpanelplugin --install 
 + 
 +  [cPanel/WHM Environment Only] Turn off auto install for the LiteSpeed user-end plugin for cPanel: 
 +  ./lscmctl cpanelplugin -autoinstall 0 
 + 
 +  Add a single WordPress Installations to custom data file.: 
 +  ./lscmctl addinstalls -wpinstall /​home/​user/​public_html/​wp /​home/​user/​public_html user.com user.com/​wp 
 + 
 +  Add multiple WordPress Installations to custom data file using an installs file.: 
 +  ./lscmctl addinstalls -wpinstallsfile /​path/​to/​installs/​file 
 +</​code>​ 
 +===== 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. 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 open the cronjobs ​from ssh root with:+First, as root, open crontab ​cronjobs with command
  
 <​code>​ crontab -e </​code>​ <​code>​ crontab -e </​code>​
  
-After that, you can add a line in the usual cronjob format, similar to the following:+After that, you can add a linein the usual cronjob format, similar to the following:
  
 <​code>​ 00 03 * * * /​usr/​local/​lsws/​admin/​misc/​lscmctl scan -e </​code>​ <​code>​ 00 03 * * * /​usr/​local/​lsws/​admin/​misc/​lscmctl scan -e </​code>​
  
-This command will run the CLI script daily at 3am, re-discovering all WordPress installations and mass enabling LSCWP on any unflagged installations.+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.
  • Admin
  • Last modified: 2020/01/03 19:33
  • by Michael Alegre