Skip to content

Cache Redis for Users CLI

Using the WHM panels to rollout a large number of Redis installations for LiteSpeed might be too difficult to do and so we provide a command line interface (CLI). This can also help in installing systems where use of the panels may be problematic.

This is done with the redis_user_action.sh program, found in /usr/local/cpanel/whostmgr/docroot/cgi/lsws/bin/.

This program must be run as root and can be used to do most everything that can be done with the Cache Redis panels. If there is an error it will return a non-zero program return code.

The use of this program begins with the first parameter which is an action. Additional parameters depend on the action specified.

Syntax:

./redis_user_action <action> [parameters]

The following actions are available:

Action Description
cleanup Stop and delete the service for a user and delete the configuration
cleanupsvc Stop and delete the service for a user and preserve the configuration
configdel Remove the redis configuration file from the redis user services and restart them
configupd Add or update the redis configuration file for the redis user services and restart them
defaultsizeget Display the default redis configuration size
defaultsizeset Create a default redis configuration size
disablepkg Delete all of the services for the users in a package
enable Configure and activate the redis service for one or more users
enablepkg Create and start redis services for each user referenced in a package
list List running services
list-setup List users which have been individually configured

cleanup

./redis_user_action.sh cleanup <UID>

Stop and delete the service for a user, and delete the configuration.

Parameter Description
<UID> ID of user to stop the service for

Example

Stop and delete the service and configuration for user 1011:

./redis_user_action.sh cleanup 1011

cleanupsvc

./redis_user_action.sh cleanupsvc <username>

Stop and delete the service for a user, and perserve the configuration.

Parameter Description
<username> Name of user to stop the service for

Example

Stop and delete the service for user example:

./redis_user_action.sh cleanupsvc example

configdel

./redis_user_action.sh configdel

Remove the redis configuration file from the redis user services and restart them. No parameters.

configupd

./redis_user_action.sh configupd <filename>

Add or update the redis configuration file for the redis user services and restart them.

Parameter Description
<filename> Fully qualified configuration file name

Example

Update the configuration file found at /usr/local/lsws/lsns/conf/redis.conf:

./redis_user_action.sh configupd /usr/local/lsws/lsns/conf/redis.conf

defaultsizeget

./redis_user_action.sh defaultsizeget

Display the default redis configuration size. No parameters.

defaultsizeset

./redis_user_action.sh defaultsizeset <size>

Create a default redis configuration size.

Parameter Description
<size> Size in MB
To delete, set <size> to 0.

Example

Set default redis configuration size to 10MB:

./redis_user_action.sh defaultsizeset 10

disablepkg

./redis_user_action.sh disablepkg <package>

Delete all of the services for the users in a package.

Parameter Description
<package> Package name
To delete, set <size> to 0.

Example

Delete all of the service for the users in the default package:

./redis_user_action.sh disablepkg default

enable

./redis_user_action.sh enable <lsws-home> <username> <user-home> <size>

Configure and activate the redis service for one or more users.

Parameter Description
<lsws-home> LiteSpeed Web Server home directory
<username> Username to enable the service for
<user-home> User's home directory
<size> Redis size in MB for this service

The <username>, <user-home>, and <size> triplet can repeat one or more times.

Example

Activate 10MB service for the example user, and 20MB service for the example2 user:

./redis_user_action.sh enable /usr/local/lsws example /home/example 10 example2 /home/example2 20

enablepkg

./redis_user_action.sh enablepkg <package>

Create and start redis services for each user referenced in a package.

Parameter Description
<package> Package name

Tip

You must run lspkgctl to define the size of the package before enabling it.

Example

Create and start redis services for each user referenced in the default package:

./redis_user_action.sh enablepkg default

list

./redis_user_action.sh list

List running services. No parameters.

list-setup

./redis_user_action.sh list-setup

List users which have been individually configured (not by default or package). No parameters.