PST Commands (3.1.15)

Overview

PST Command is a CLI (Command Line Interface) to control the function of WEXAL® Page Speed Technology (hereinafter referred to as "PST"). The command is "/usr/bin/pst".

  • Users
    • PST Commands can be executed by the root user or by users belonging to the "www" group. (Kusanagi users belong to the “www” group by default.)
  • Profiles
    • PST profiles can be specified by each subcommand. Note, if you want to specify a profile, make sure to specify it at the end of the command line. If omitted, each sub-command will be executed for the profile in the current directory. When the current directory is not a valid profile, an error will occur.
  • Notations
    • { a | b }
      You need to specify either "a" or "b". This cannot be omitted.
    • [ a ]
      You can specify "a". If omitted, the command will be executed by default.

-V | --version

Use this command to check which version of PST is running.

Example

pst -V
pst --version

Options

None

Results

[kusanagi@kusanagi8 ~]$ pst -V
PST Version : 3.0.0

-h | --help

Displays the usage of the "pst" command and each subcommand.

Example

pst -h
pst init -help
pst opt all -h

Options

None

[--dryrun] {subcommand}

Allows you to check the results of executing a PST subcommand without actually executing the subcommand. Note, the "--dryrun" option must be specified immediately before the subcommand.

Example

pst --dryrun init
pst --dryrun opt all --path /wp-content

Options

Varies according to each PST subcommand.

init [option] [profile]

Use this command to setup the initial PST configuration for KUSANAGI profile. This will deploy the PST configuration files, etc. This command is also executed when upgrading PST.

Example

pst init kusanagi_html

Options

[--http]Performs the initial configuration for the "http" profile.
Default is the "ssl" profile.
[--keepdb]When executing "pst init", PST will not auto-delete the DB that stores optimization strategies and resources from analyzing the website.
The default setting is to auto-delete the DB because the DB schema may change during the upgrade.
[--reverseproxy]Specifies the reverse proxy URL (original) after "--reverseproxy" to initialize as a reverse proxy profile.
The default setting is not to initialize a reverse proxy.
[--origin]Specifies the original FQDN after "--origin" when initializing the profile as a reverse proxy profile. Use this option if the reverse proxy FQDN and the original FQDN are different.
Default is the same as the reverse proxy FQDN.
[--websocket]Enables WebSocket communication in the reverse proxy.
The default setting is "disabled".
[--nano]Enables "nano".
The default setting is "disabled".
[profile]If “profile” is specified, this command will be executed in the specified profile.
The default is to operate on the profile of the current directory. When the current directory does not have a valid profile, an error will occur.

config init [profile]

Initializes the PST configuration file for the specified profile.

Example

pst config init kusanagi_html

Options

[profile]If “profile” is specified, this command will be executed in the specified profile.
The default is to operate on the profile of the current directory. When the current directory does not have a valid profile, an error will occur.

config commit [profile]

Applies the PST configuration file to the production environment of the specified profile.

Example

pst config commit --path pst.stg.config.yaml kusanagi_html

Options

--pathSpecifies the PST configuration file path after "--path" to be applied in the production environment.
[profile]If “profile” is specified, this command will be executed in the specified profile.
The default is to operate on the profile of the current directory. When the current directory does not have a valid profile, an error will occur.

config crawl [option] [profile]

Makes a request to pre-generate optimization strategies for a profile.
The Optimization Strategy Service will process sequentially the generation of optimization strategies. It may take time depending on the number of web pages to be analyzed. You can check the analysis progress with the status command.

Example

pst config crawl --url https://kusanagi.example.com --depth 2 kusanagi_html

Options

--urlSpecifies the top URL of the website after "--url" to be analyzed.
[--configname]Generates a PST configuration file and optimization strategy with the specified name. Please specify the name after "--configname".
The default name is unspecified (production environment).
[--depth]When analyzing a website, specifies the number of link levels after "--depth" to follow from the top URL.
The default level is 1, and only the top page will be analyzed.
[--warmup]When analyzing a website, generates an optimization strategy regardless of the validity period.
The default setting is not to generate if the optimization strategy is within the validity period.
[profile]If “profile” is specified, this command will be executed in the specified profile.
The default is to operate on the profile of the current directory. When the current directory does not have a valid profile, an error will occur.

config cluster [option] [profile]

Generates a static optimization strategy as a PST configuration file based on the optimization strategy already generated.

Example

pst config cluster --url https://kusanagi.example.com kusanagi_html

Options

--urlSpecifies the top URL of the website after "--url" to be analyzed.
[--configname]Generates a PST configuration file and optimization strategy with the specified name. Please specify the name after "--configname".
The default name is unspecified (production environment).
[profile]If “profile” is specified, this command will be executed in the specified profile.
The default is to operate on the profile of the current directory. When the current directory does not have a valid profile, an error will occur.

config ai -- [option] [profile]

Note, this config ai command is obsolete in PST 3.1.2. Use the config crawl and config cluster commands.

Pre-generates optimization strategies for a profile. Generates a static optimization strategy as a PST configuration file. This subcommand requires a "--" between options.

Example

pst config ai -- --depth 1 kusanagi_html

Options

[--url]Specifies the top URL of the website after "--url" to be analyzed.
The default value is the top URL of the KUSANAGI profile.
[--diagnosis]Outputs detailed analysis information.
The default setting is no output.
[--benchmark]Displays the execution time for using Nautilus or Logbook.
The default setting is no display.
[--configname]Generates a PST configuration file and optimization strategy with the specified name. Please specify the name after "--configname".
The default name is "david" for the PST configuration file and no specified name for the optimization strategy (production environment).
[--depthWhen analyzing a website, specifies the number of link levels after "--depth" to follow from the top URL.
The default level is 2. Analyzes from the top page to the next linked page.
[--list]Specifies the URL of websites after "--list" to be analyzed in a file. Lists one URL per line in a text file. Note, when "--list" is specified, "--url" will be disabled and depth will be automatically set to 1.
Default will follow "--url" and "--depth" respectively.
[--no-redirect]This option disables the crawling of redirects. However, if there is no HTML to crawl as a result, "config" generation will result in an error.
The default setting is to crawl.
[--voyage]When analyzing a website, doesn't use the browser cache, but always accesses the website to retrieve resources.
The default setting is to use a browser cache preferentially for analysis.
[--voyage-on-error]When there is an error in the browser cache when analyzing a website, accesses the website and retrieves resources without using the cache.
The default setting is to use browser cache preferentially and analyze the website even if the cache has an error.
[--voyage-on-redirect]When there is a redirect in the browser cache when analyzing a website, accesses the website and retrieves resources without using the cache.
The default setting is to use browser cache preferentially and analyze the website even when there is a redirect.
[--timeout]Sets the timeout period in seconds after "--timeout" to retrieve web pages for analysis. If set at 0, this command will wait until there is a response from the web page.
The default setting is 30 seconds.
[--no-cacheEnabled]When analyzing a website, disables the browser cache.
The default setting is "enabled".
[--interceptRequest]When analyzing a website, does not retrieve anything other than documents and JavaScript/Stylesheet.
The default setting is to retrieve all resources.
[--no-ignoreAnalytics]When analyzing a website, allows requests to "www.google-analytics.com" for website analytics.
The default setting is to block requests to "www.google-analytics.com", so that access to the website is not counted by Google Analytics.
[--ignoreExtensions]When analyzing a website, retrieves resources while ignoring extensions.
The default setting is to retrieve only ".js" and ".css" resources.
[--useHttpcli]Uses "httpcli" instead of the standard "puppeteer" when analyzing. "httpcli" is less machine resource consuming and faster than "puppeteer", but it cannot retrieve LCP.
The default setting is to use "puppeteer".
[--lua]Generates optimization strategies with the "lua" directive.
The default setting is the "lua" directive.
[--wp]Generates optimization strategies with "wp" directive.
The default setting is the "lua" directive. When both "--lua" and "--wp", are specified, "wp" will generate optimization strategies.
[--classify]Analyzes JavaScript. The results are saved in Logbook.
The default setting is not to analyze JavaScript.
[--expire]When analyzing a website, generates optimization strategies if the current optimization strategy was generated before the specified time. Please specify the original time after "--expire". If 0 is specified, a new strategy will always be generated.
The default setting is to always generate.
[--lighthouseLcp]Retrieves LCP by Lighthouse when analyzing websites.
The default setting is for "puppeteer" to retrieve LCP.
[profile]If “profile” is specified, this command will be executed in the specified profile.
The default is to operate on the profile of the current directory. When the current directory does not have a valid profile, an error will occur.

initdb [profile]

Initializes the DB that stores optimization strategies and resources when analyzing a website.

Example

pst initdb kusanagi_html

Options

[profile]If “profile” is specified, this command will be executed in the specified profile.
The default is to operate on the profile of the current directory. When the current directory does not have a valid profile, an error will occur.

lighthouse [profile]

Executes Lighthouse. The results of the execution are output to the profile directory, "wexal/userdir/out/lighthouse.html".

Example

pst lighthouse --url https://kusanagi.example.com/ kusanagi_html

Options

--urlSpecifies the URL of the website after "--url" in which to execute Lighthouse.
[profile]If “profile” is specified, this command will be executed in the specified profile.
The default is to operate on the profile of the current directory. When the current directory does not have a valid profile, an error will occur.

on [profile]

Enables PST.

Example

pst on kusanagi_html

Options

[profile]If “profile” is specified, this command will be executed in the specified profile.
The default is to operate on the profile of the current directory. When the current directory does not have a valid profile, an error will occur.

off [profile]

Disables PST.

Example

pst off kusanagi_html

Options

[profile]If “profile” is specified, this command will be executed in the specified profile.
The default is to operate on the profile of the current directory. When the current directory does not have a valid profile, an error will occur.

opt all [option] [profile]

Executes resource optimization for all resources. This command directs the execution of WEXAL Resource Optimization Service ("optimizer"). When the Resource Optimization Service ("optimizer") has not started, execution will be suspended until the service has started.

Example

pst opt all --path /wp-content/uploads kusanagi_html

Options

[--force]Executes resource optimization forcibly.
By default, if a resource-optimized file already exists and the resource has not changed, optimization will not be run again.
[--priority]Executes resource optimization with a highest priority. Even if other resource optimizations are in progress, the resource optimization specified in this command will be given priority.
By default, resource optimization commands are processed in the order in which they are executed. Also, if real-time resource optimization by the profile monitoring process is running, it will be done after the priority series of optimizations is complete.
[--path]Specifies the directory or file path after "--path" for resource optimization. Note, the absolute path from the DocumentRoot of the KUSANAGI profile must be set.
The default path is slash (/). All files under the DocumentRoot (able to be optimized) are in scope.
An error will occurr if you set a directory or file that does not exist.
[profile]If “profile” is specified, this command will be executed in the specified profile.
The default is to operate on the profile of the current directory. When the current directory does not have a valid profile, an error will occur.

opt image [option] [profile]

Executes resource optimization for image resources. This command directs the execution of WEXAL Resource Optimization Service ("optimizer"). When the Resource Optimization Service ("optimizer") has not started, execution will be suspended until the service has started.

Example

pst opt image --path /wp-content/uploads kusanagi_html

Options

[--force]Executes resource optimization forcibly.
By default, if a resource-optimized file already exists and the resource has not changed, optimization will not be run again.
[--priority]Executes resource optimization with a highest priority. Even if other resource optimizations are in progress, the resource optimization specified in this command will be given priority.
By default, resource optimization commands are processed in the order in which they are executed. Also, if real-time resource optimization by the profile monitoring process is running, it will be done after the priority series of optimizations is complete.
[--path]Specifies the directory or file path after "--path" for resource optimization. Note, the absolute path from the DocumentRoot of the KUSANAGI profile must be set.
The default path is slash (/). All files under the DocumentRoot (able to be optimized) are in scope.
An error will occurr if you set a directory or file that does not exist.
[profile]If “profile” is specified, this command will be executed in the specified profile.
The default is to operate on the profile of the current directory. When the current directory does not have a valid profile, an error will occur.

opt js [option] [profile]

Executes resource optimization for script resources. This command directs the execution of WEXAL Resource Optimization Service ("optimizer"). When the Resource Optimization Service ("optimizer") has not started, execution will be suspended until the service has started.

Example

pst opt js --path /wp-content/uploads kusanagi_html

Options

[--force]Executes resource optimization forcibly.
By default, if a resource-optimized file already exists and the resource has not changed, optimization will not be run again.
[--priority]Executes resource optimization with a highest priority. Even if other resource optimizations are in progress, the resource optimization specified in this command will be given priority.
By default, resource optimization commands are processed in the order in which they are executed. Also, if real-time resource optimization by the profile monitoring process is running, it will be done after the priority series of optimizations is complete.
[--path]Specifies the directory or file path after "--path" for resource optimization. Note, the absolute path from the DocumentRoot of the KUSANAGI profile must be set.
The default path is slash (/). All files under the DocumentRoot (able to be optimized) are in scope.
An error will occurr if you set a directory or file that does not exist.
[profile]If “profile” is specified, this command will be executed in the specified profile.
The default is to operate on the profile of the current directory. When the current directory does not have a valid profile, an error will occur.

opt css [option] [profile]

Executes resource optimization for style sheet resources. This command directs the execution of WEXAL Resource Optimization Service ("optimizer"). When the Resource Optimization Service ("optimizer") has not started, execution will be suspended until the service has started.

Example

pst opt css --path /wp-content/uploads kusanagi_html

Options

[--force]Executes resource optimization forcibly.
By default, if a resource-optimized file already exists and the resource has not changed, optimization will not be run again.
[--priority]Executes resource optimization with a highest priority. Even if other resource optimizations are in progress, the resource optimization specified in this command will be given priority.
By default, resource optimization commands are processed in the order in which they are executed. Also, if real-time resource optimization by the profile monitoring process is running, it will be done after the priority series of optimizations is complete.
[--path]Specifies the directory or file path after "--path" for resource optimization. Note, the absolute path from the DocumentRoot of the KUSANAGI profile must be set.
The default path is slash (/). All files under the DocumentRoot (able to be optimized) are in scope.
An error will occurr if you set a directory or file that does not exist.
[profile]If “profile” is specified, this command will be executed in the specified profile.
The default is to operate on the profile of the current directory. When the current directory does not have a valid profile, an error will occur.

passwd list

Displays the users available for login to PST Manager.

Example

pst passwd list

Options

None

passwd add [option]

Use this command to add users able to login to PST Manager.

Example

pst passwd add --user example_user --pass example_pass

Options

[--user]Specify a user name after "--user". If omitted, enter the user name from the command prompt.
The user name must be a combination of lowercase and uppercase letters, numbers, . (period), _ (underscore), and - (hyphen), and at least 3 and no more than 16 characters long.
[--pass]Specify a password after "--pass". If omitted, enter the password from the command prompt.
The password can be lowercase or uppercase English letters, numbers, . (period), ! (exclamation), # (sharp), % (percent), + (plus), _ (underscore), - (hyphen), and must be at least 8 characters long.

passwd delete [option]

Use this command to delete users able to login to PST Manager.

Example

pst passwd delete --user example_user

Options

[--user]Specify a user name after "--user". If omitted, enter the user name from the command prompt.

purge all [option] [profile]

Purges all optimized resources This command also purges external resources (images, scripts, style sheets) and external CSS proxied locally by the "proxy" directive, as well as CSS for "webfont" generated as an optimization file if the inline CSS contains "webfont".

Example

pst purge all --reverseproxy --path /wp-content/themes kusanagi_html

Options

[--reverseproxy]Purges cache resources under the DocumentRoot in a reverse proxy environment.  Note, if this option is executed in a non-reverse proxy environment, it will be ignored.
The default setting is not to purge browser cache resources.
[--webfont]Purges "webfont" CSS generated as an optimization file when "webfont" is included in external CSS or inline CSS.
This option is enabled from PST 3.1.15.
[--path]Specifies the directory or file path after "--path" for resource optimization. Note, the absolute path from the DocumentRoot of the KUSANAGI profile must be set.
The default path is slash (/). All files under the DocumentRoot (able to be optimized) are in scope.
An error will occurr if you set a directory or file that does not exist.
[-y]Executes purge action without entering "y/n" on command prompt.
The default is to prompt for "y/n" when purging optimized resources.
[profile]If “profile” is specified, this command will be executed in the specified profile.
The default is to operate on the profile of the current directory. When the current directory does not have a valid profile, an error will occur.

purge excluded [option] [profile]

Purges optimized resources that have been excluded from optimization for some reason, and optimized resources that are older than the original file. The latest optimized resources are not in scope.

Example

pst purge excluded --path /wp-content/themes kusanagi_html

Options

[--reverseproxy]Purges cache resources under the DocumentRoot in a reverse proxy environment.  Note, if this option is executed in a non-reverse proxy environment, it will be ignored.
The default setting is not to purge browser cache resources.
[--webfont]Purges "webfont" CSS generated as an optimization file when "webfont" is included in external CSS or inline CSS. The default setting is not to purge "webfont" CSS.
[--path]Specifies the directory or file path after "--path" for resource optimization. Note, the absolute path from the DocumentRoot of the KUSANAGI profile must be set.
The default path is slash (/). All files under the DocumentRoot (able to be optimized) are in scope.
[-y]Executes purge action without entering "y/n" on command prompt.
The default is to prompt for "y/n" when purging optimized resources.
[profile]If “profile” is specified, this command will be executed in the specified profile.
The default is to operate on the profile of the current directory. When the current directory does not have a valid profile, an error will occur.

purge expires [option] [profile]

Purges optimized resources older than the specified period. Note, this command purges external resources (images, scripts, style sheets), external CSS, and CSS generated as optimized files when "webfont" is included in inline CSS, which is proxied locally by the "proxy" directive.

Example

pst purge expires --period 60d --path /wp-content/themes kusanagi_html

Options

--periodSpecify a period after "--period" using a combination of numeric values and date/time units (y: year, M: month, w: week, d: day, h: hour, m: minute, s: second). The year is fixed at 365 days (1y = 365d) and the month at 30 days (1M = 30d).
Example: --expires 1M10d: previous to 40 days ago, 36h: previous to 36 hours ago.
[--reverseproxy]Purges cache resources under the DocumentRoot in a reverse proxy environment.  Note, if this option is executed in a non-reverse proxy environment, it will be ignored.
The default setting is not to purge browser cache resources.
[--webfont]Purges "webfont" CSS generated as an optimization file when "webfont" is included in external CSS or inline CSS.
This option is enabled from PST 3.1.15.
[--path]Specifies the directory or file path after "--path" for resource optimization. Note, the absolute path from the DocumentRoot of the KUSANAGI profile must be set.
The default path is slash (/). All files under the DocumentRoot (able to be optimized) are in scope.
An error will occurr if you set a directory or file that does not exist.
[-y]Executes purge action without entering "y/n" on command prompt.
The default is to prompt for "y/n" when purging optimized resources.
[profile]If “profile” is specified, this command will be executed in the specified profile.
The default is to operate on the profile of the current directory. When the current directory does not have a valid profile, an error will occur.

queue

Displays the status of queues used by WEXAL services. The queue for the Resource Optimization Service ("optimizer") is "optimizer" and "strategy" is the queue for the Optimization Strategy Service ("strategy").

Example

pst queue

Options

None

remove [option] [profile]

Removes PST from the specified profile. By executing this command, you can return to the previous KUSANAGI profile environment. Note, if you have changed the "nginx" configuration files after executing "pst init", the environment will be returned to before those changes were made. Please check the "nginx" settings after executing "pst remove", especially if you have changed SSL certificates or other settings later with the "kusanagi ssl" command, etc.

Example

pst remove kusanagi_html

Options

[-y]Removes action without entering "y/n" on command prompt.
The default is to prompt for "y/n" when removing.
[profile]If “profile” is specified, this command will be executed in the specified profile.
The default is to operate on the profile of the current directory. When the current directory does not have a valid profile, an error will occur.

status [profile]

Displays PST status. Displays PST enable/disable, resource monitoring enable/disable, the Resource Optimization Service ("optimizer") queue, and the Optimization Strategy Service ("strategy") queue.

Example

pst status kusanagi_html

Options

[profile]If “profile” is specified, this command will be executed in the specified profile.
The default is to operate on the profile of the current directory. When the current directory does not have a valid profile, an error will occur.

watch on [profile]

Enables resource monitoring for a specified profile. Resource Monitoring monitors the profile in real time and directs the Resource Optimization Service ("watch") according to resource changes. When the Resource Optimization Service ("watch") has not started, execution will be suspended until the service has started. Resource monitoring directs the Resource Optimization Service ("watch") to run with the highest priority. Therefore, even if the command has optimizations in progress, this service will direct that resources that have changed be given highest priority.

Example

pst watch on kusanagi_html

Options

[profile]If “profile” is specified, this command will be executed in the specified profile.
The default is to operate on the profile of the current directory. When the current directory does not have a valid profile, an error will occur.

watch off [profile]

Disables resource monitoring for a specified profile. When resource monitoring is disabled, resource optimization and purges will not be performed in real time. Therefore, please execute resource optimization and purge commands as needed.

Example

pst watch off kusanagi_html

Options

[profile]If “profile” is specified, this command will be executed in the specified profile.
The default is to operate on the profile of the current directory. When the current directory does not have a valid profile, an error will occur.

watch restart [profile]

Restarts resource monitoring for a specified profile.

Example

pst watch restart kusanagi_html

Options

[profile]If “profile” is specified, this command will be executed in the specified profile.
The default is to operate on the profile of the current directory. When the current directory does not have a valid profile, an error will occur.

watch status [profile]

Displays resource monitoring status for a specified profile.

Example

pst watch status kusanagi_html

Options

[profile]If “profile” is specified, this command will be executed in the specified profile.
The default is to operate on the profile of the current directory. When the current directory does not have a valid profile, an error will occur.