Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
litespeed_wiki:cpanel:cli-lscwp-management [2018/06/12 21:19] Michael Alegre [Setup CronJob in cPanel] |
litespeed_wiki:cpanel:cli-lscwp-management [2019/02/08 17:34] Michael Alegre Added mention of our WHM plugin to first paragraph. |
||
---|---|---|---|
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. 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.]] | ||
Line 7: | Line 9: | ||
<code> | <code> | ||
- | LiteSpeed Cache Manager Script Help Page | + | LiteSpeed Cache Manager CLI Tool v1.3 |
- | This script requires that you have cPanel with LiteSpeed Web Server Plugin installed. | ||
Usage: ./lscmctl [-php path/to/php] command [flag/parameter] | Usage: ./lscmctl [-php path/to/php] command [flag/parameter] | ||
- | Possible Commands: | + | Possible Commands: |
- | scan [-n] [-e] | + | setcacheroot [-svr <cache root>] [-vh <cache root>] |
- | Scan for all WordPress installations. This command will create an lsc_manager_data file under the '.../lsws/admin/lscdata' directory. | + | List/Set server and/or virtual host cache roots. This command will list the |
- | Add the -n flag to only discover new installations. | + | current server and virtual host cache roots when no additional input is given. |
- | By adding the -e flag, LSC-WP will be enabled on all installations after scanning is complete. | + | 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] | [$VERSION] | + | setversion [--list] | [--latest] | <version> |
- | List/Set active LSCWP version. This command will list the currently active version when no additional input it given. | + | List/Set active LSCWP version. This command will list the currently active |
- | Use --list to show available versions. Provide a valid version number to switch to that version. | + | 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. | ||
- | enable -m | $WP_PATH | + | scan [-n] [-e] |
- | Enables LSWCP for all discovered WordPress installations with the -m parameter or a single installtion by providing the path to the WordPress | + | Scan for all WordPress installations. This command will create an lscm.data |
- | installation directory. | + | 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. | ||
- | disable -m | $WP_PATH | + | enable -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 | + | Enables LSWCP for all discovered WordPress installations with the -m |
- | installation directory. | + | parameter or a single installtion by providing the path to the WordPress |
+ | installation directory. | ||
- | upgrade -m | $WP_PATH | + | disable -m | <wp path> |
- | Upgrade LSWCP for all discovered WordPress installations to the current active version with the -m parameter or a single installation by | + | Disables LSWCP for all discovered WordPress installations with the -m |
- | providing the path to the WordPress installation directory. | + | parameter or a single installtion by providing the path to the WordPress |
+ | installation directory. | ||
- | flag $WP_PATH | + | upgrade -m | <wp path> |
- | Flag a single WordPress installation. Flagged installations will be skipped during mass operations. | + | 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. | ||
- | unflag $WP_PATH | + | flag <wp path> |
- | Unflag a single WordPress installation. Flagged installations will be skipped during mass operations. | + | Flag a single WordPress installation. Flagged installations will be skipped |
+ | during mass operations. | ||
- | status $WP_PATH | + | unflag <wp path> |
- | Get the most up to date LSCWP status for the provided WordPress installation. | + | 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: | Example Usage: | ||
- | Discover all installations: | + | List server and virtual host cache roots: |
- | ./lscmctl scan | + | ./lscmctl setcacheroot |
+ | |||
+ | Set virtual host cache root: | ||
+ | ./lscmctl setcacheroot -vh /path/to/ssd/lscache | ||
+ | |||
+ | Display currently active LSCWP version: | ||
+ | ./lscmctl setversion | ||
+ | |||
+ | Display selectable LSCWP versions: | ||
+ | ./lscmctl setversion --list | ||
+ | |||
+ | Set active LSCWP version to latest available: | ||
+ | ./lscmctl setversion --latest | ||
- | Discover new installations only, passing in path to php binary: | + | Set active LSCWP version to v1.5: |
- | ./lscmctl -php /path/to/php/ scan -n | + | ./lscmctl setversion 1.5 |
- | Display currently active LSCWP version: | + | Discover all installations: |
- | ./lscmctl setversion | + | ./lscmctl scan |
- | Set new active LSCWP version: | + | Discover new installations only, passing in path to php binary: |
- | ./lscmctl setversion 1.5 | + | ./lscmctl -php /path/to/php/ scan -n |
- | Enable LSCWP on all discovered installations: | + | Enable LSC-WP on all discovered installations: |
- | ./lscmctl enable -m | + | ./lscmctl enable -m |
- | Disable LSCWP for a single installation: | + | Disable LSC-WP for a single installation: |
- | ./lscmctl disable /home/user/public_html/wp | + | ./lscmctl disable /home/user/public_html/wp |
- | Get LSCWP status for a single installation: | + | Get LSC-WP status for a single installation: |
- | ./lscmctl status /home/user/public_html/wp | + | ./lscmctl status /home/user/public_html/wp |
</code> | </code> | ||
- | ====== Scan And Enable Using A CronJob ====== | + | ===== 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 line, in 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. |