The process_site_templates Script

Last modified: July 28, 2022

Overview

Important:
You cannot run this script as the root user.

The /scripts/process_site_templates script processes template files and user-provided data to create a Site Publisher website.

When users publish a Site Publisher website, the script performs the following actions:

  1. The script logs template information and the target directory to the /usr/local/cpanel/logs/error_log file.
  2. The script saves a copy of the target directory’s current contents as a tarball in the /home/user/site_publisher/backups/ directory, where user represents the account’s username.
    Note:
    If the system encounters a file system or file quota error during this step, it will not save the tarball and will not publish the new Site Publisher website.
  3. The script deletes any Site Publisher backup tarballs that are more than 30 days old.
  4. The script generates and saves the new Site Publisher website’s files.
    Notes:
    • If one of the new website’s files conflicts with an existing file, the system overwrites the existing file with the new file.
    • If the system encounters an error during this step, it restores the target directory’s original contents from the backup tarball and does not publish the new Site Publisher website.
    • The system saves configuration information for the new website in the /home/user/site_publisher/configurations directory, where user represents the account’s username. It saves this files as the home-user-public_html-example.com.json file, where home-user-public_html-example.com represents the Site Publisher website’s target directory, with hyphens ( - ) instead of slashes ( / ).

Run the /scripts/process_site_templates script

To run the /scripts/process_site_templates script on the command line, use the following format:

/scripts/process_site_templates [options]

Options

You can use the following options with the /scripts/process_site_templates script:

  • --define — Define a template variable and its desired value. Each template variable requires a separate --define flag.

    Important:

    The template that you specify determines the values to define.

    • If you use a cPanel-provided template, read our Guide to Site Publisher Templates documentation for a list of template variables.
    • If you use a third-party template, consult that template’s documentation or its meta.json file.
  • --help — Display a help message.

  • --source — Define the absolute path to the template’s source location.

    • /var/cpanel/customizations/site_templates/ — The root user’s templates.
    • /home/username/var/cpanel/reseller/site_templates/ — A reseller’s templates, where username represents the reseller’s username.
    • /usr/local/cpanel/etc/site_templates/ — cPanel-provided templates in cPanel & WHM version 56 through 68.
    • /usr/local/cpanel/3rdparty/share/site_templates/ — cPanel-provided templates in cPanel & WHM version 70 and later.
  • --target — Define the absolute path to the directory to which you wish to publish the Site Publisher website. Generally, you should specify the target domain’s home directory path.

Example

For example, to use the /scripts/process_site_templates script, you could run the following command:

/scripts/process_site_templates --source=/var/cpanel/customizations/site_templates/my_template --target=/home/username/public_html/example.com --define business_name="National Emotion, Inc." --define phone="867-5309" --define contact="jenny@example.com"

This example uses the root user’s my_template template to publish a website for the username cPanel user’s example.com domain, and defines values for three parameters that the my_template template uses.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

The servers_queue Script

Valid for versions 82 through the latest version Last modified: June 21, 2021...

The auto-adjust-mysql-limits Script

Valid for versions 82 through the latest version Last modified: June 21, 2021...

The autossl_check Script

Valid for versions 82 through the latest version Last modified: May 13, 2020 Overview...

The backup Script

Valid for versions 82 through the latest version Last modified: May 13, 2020 Overview...

The backup_restore_manager Script

Valid for versions 82 through the latest version Last modified: July 28, 2022...