How to Automatically Install a Script Upon User Account Creation


Fantastico F3 contains a built-in CLI shell which is very versatile. It allows you to install a script using a single command (via the CLI shell). This is 100% scriptable and therefore easy to automate (more on that below).

Syntax:

cd /var/netenberg/fantastico_f3/sources && php index.php shell install $script

If you want to know the options available for any script, you can simply do this:

cd /var/netenberg/fantastico_f3/sources && php index.php shell help $script

Example #1: (the following is a plain-text version of what you generally see in Step 1 within a browser)

$ cd /var/netenberg/fantastico_f3/sources && php index.php shell help word-press

Requirements:
    Disk Space: Pass
    Apache 1+: Fail
    MySQL 5.0+/MariaDB 10.0+: Pass
    PHP 5.2.4+: Pass
Parameters:
    Location Details
        Domain; --domain;
        Directory; --directory; Leave this field empty if you want to install in the web root for the domain you've selected (i.e., http://domain.com/ ). If you'd like to install in a subdirectory, please enter the path to the directory relative to the web root for your domain. The final destination subdirectory should not exist, but all others can exist (e.g., http://domain.com/some/sub/directory - In this case, "directory" should not already exist).
    Administrator Details
        Username; --user_name; maximum 60 characters; must not contain any special characters except hyphen, period, underscore
        Password; --admin_password; minimum 7 characters
        Email; --admin_email;
    Other Details
        Title; --weblog_title;
    Plugins
        Rublon; --install_rublon; Install Rublon Account Protection - <a href="http://wordpress.rublon.com/" target="_blank">http://wordpress.rublon.com/</a>
Example:
    php index.php shell install word-press --domain="..." --directory="..." --user_name="..." --admin_password="..." --admin_email="..." --weblog_title="..." --install_rublon="..."

Example #2:

$ cd /var/netenberg/fantastico_f3/sources && php index.php shell help pagekit

Requirements:
    Disk Space: Pass
    Apache 2.2+: Fail
    MySQL 5.1+/MariaDB 10.0+: Pass
    PHP 5.5.9+: Pass
    PHP :: ctype: Pass
    PHP :: dom: Pass
    PHP :: json: Pass
    PHP :: mbstring: Pass
    PHP :: mysql: Pass
    PHP :: pcre: Pass
    PHP :: PDO: Pass
    PHP :: session: Pass
    PHP :: SimpleXML: Pass
    PHP :: tokenizer: Pass
    PHP :: zip: Pass
Parameters:
    Location Details
        Domain; --domain;
        Directory; --directory; Leave this field empty if you want to install in the web root for the domain you've selected (i.e., http://domain.com/ ). If you'd like to install in a subdirectory, please enter the path to the directory relative to the web root for your domain. The final destination subdirectory should not exist, but all others can exist (e.g., http://domain.com/some/sub/directory - In this case, "directory" should not already exist).
    Administrator Details
        Username; --username;
        Password; --password;
        Email; --email;
    Site Details
        Title; --title;
Example:
    php index.php shell install pagekit --domain="..." --directory="..." --username="..." --password="..." --email="..." --title="..."

Armed with the above information, you can easily automate the process of installing a script upon account creation.

References (for WHM/cPanel)

In this event/stage, if you want to install WordPress, you must simply execute one command.

cd /var/netenberg/fantastico_f3/sources && php index.php shell install word-press \
    --domain="..." \ (this variable is available in the post-hook)
    --directory="..." \
    --user_name="..." \
    --admin_password="..." \
    --admin_email="..." \
    --weblog_title="..." \
    --install_rublon="..."

Step 1: Create a new file named /opt/wordpress.sh and copy the aforementioned code inside it (make sure it is executable; chmod 755 /opt/wordpress.sh).

Step 2: Register your file with the following command:

/usr/local/cpanel/bin/manage_hooks add script /opt/wordpress.sh --manual --category Whostmgr --event 'Accounts::Create' --stage post

That's it. Now, everytime a new account is created, WordPress will be installed in the root of the domain with the given username and password.

You can also install multiple scripts when an account is created (100 copies of the same script or 100 different scripts). You just have to repeat the php index.php shell install $scriptcommand 100 times.

Tags: Fantastico F3
2016-11-30 02:47 Netenberg Staff {writeRevision}
Average rating: 5 (1 Vote)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.